You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@oodt.apache.org by bf...@apache.org on 2012/07/27 20:41:44 UTC

svn commit: r1366486 - /oodt/trunk/protocol/ftp/src/main/java/org/apache/oodt/cas/protocol/ftp/CommonsNetFtpProtocol.java

Author: bfoster
Date: Fri Jul 27 18:41:43 2012
New Revision: 1366486

URL: http://svn.apache.org/viewvc?rev=1366486&view=rev
Log:
- Fixed: CommonsNetFtpProtocol throws exception on successful download

--------------------
OODT-477

Modified:
    oodt/trunk/protocol/ftp/src/main/java/org/apache/oodt/cas/protocol/ftp/CommonsNetFtpProtocol.java

Modified: oodt/trunk/protocol/ftp/src/main/java/org/apache/oodt/cas/protocol/ftp/CommonsNetFtpProtocol.java
URL: http://svn.apache.org/viewvc/oodt/trunk/protocol/ftp/src/main/java/org/apache/oodt/cas/protocol/ftp/CommonsNetFtpProtocol.java?rev=1366486&r1=1366485&r2=1366486&view=diff
==============================================================================
--- oodt/trunk/protocol/ftp/src/main/java/org/apache/oodt/cas/protocol/ftp/CommonsNetFtpProtocol.java (original)
+++ oodt/trunk/protocol/ftp/src/main/java/org/apache/oodt/cas/protocol/ftp/CommonsNetFtpProtocol.java Fri Jul 27 18:41:43 2012
@@ -37,13 +37,13 @@ import org.apache.oodt.cas.protocol.util
  * This class is responsible for FTP transfers. It is built as a wrapper around
  * Apache's FTPClient class in order to connect it into the Crawler's Protocol
  * infrastructure.
- * 
+ *
  * @author bfoster
- * 
+ *
  */
 public class CommonsNetFtpProtocol implements Protocol {
 
-	private FTPClient ftp;
+	private final FTPClient ftp;
 	private String homeDir;
 
 	/**
@@ -157,15 +157,15 @@ public class CommonsNetFtpProtocol imple
 		OutputStream os = null;
 		try {
 			os = new FileOutputStream(toFile);
-			if (ftp.retrieveFile(fromFile.getName(), os))// {
+			if (!ftp.retrieveFile(fromFile.getName(), os)) {
 				throw new ProtocolException("Failed to download file "
 						+ fromFile.getName());
-			// }
+			}
 		} catch (Exception e) {
 			// download failed
 			toFile.delete();
 			throw new ProtocolException("FAILED to download: " + fromFile.getName()
-					+ " : " + e.getMessage());
+					+ " : " + e.getMessage(), e);
 		} finally {
 			// close output stream
 			if (os != null)
@@ -174,7 +174,7 @@ public class CommonsNetFtpProtocol imple
 				} catch (Exception e) {
 					toFile.delete();
 					throw new ProtocolException("Failed to close outputstream : "
-							+ e.getMessage());
+							+ e.getMessage(), e);
 				}
 		}
 	}