[jboss-svn-commits] JBL Code SVN: r8745 - labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/internal/soa/esb/util
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Sun Jan 7 06:16:32 EST 2007
Author: mark.little at jboss.com
Date: 2007-01-07 06:16:30 -0500 (Sun, 07 Jan 2007)
New Revision: 8745
Modified:
labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/internal/soa/esb/util/EdtFtpImpl.java
Log:
Attempted to harden some of the code.
Modified: labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/internal/soa/esb/util/EdtFtpImpl.java
===================================================================
--- labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/internal/soa/esb/util/EdtFtpImpl.java 2007-01-07 11:13:56 UTC (rev 8744)
+++ labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/internal/soa/esb/util/EdtFtpImpl.java 2007-01-07 11:16:30 UTC (rev 8745)
@@ -41,6 +41,7 @@
import com.enterprisedt.net.ftp.FTPClient;
import com.enterprisedt.net.ftp.FTPConnectMode;
+import com.enterprisedt.net.ftp.FTPException;
import com.enterprisedt.net.ftp.FTPTransferType;
/**
@@ -79,7 +80,6 @@
private String m_sRemoteDir, m_sLocalDir;
-
/**
* Checks validity and completeness of parameters, and keeps the info
* internally for subsequent FTP requests
@@ -104,7 +104,6 @@
initialize(p_bConnect);
}
-
public EdtFtpImpl(FTPEpr p_oP, boolean p_bConnect) throws Exception
{
@@ -253,7 +252,19 @@
*/
public void deleteRemoteFile(String p_sFile) throws Exception
{
- m_oConn.delete(getRemoteDir() + "/" + new File(p_sFile).getName());
+ try
+ {
+ m_oConn.delete(getRemoteDir() + "/" + new File(p_sFile).getName());
+ }
+ catch (Exception ex)
+ {
+ // TODO better error handling
+
+ /*
+ * It seems as though we have a race condition whereby one thread
+ * tries to remove a file when another renames it!
+ */
+ }
}
/*
@@ -274,6 +285,7 @@
} catch (Exception e)
{
}
+
m_oConn.get(FtpUtils.fileToFtpString(oLclFile), p_sFile);
File oNew = new File(oLocalDir, p_sFinalName);
@@ -290,7 +302,17 @@
public String[] getFileListFromRemoteDir(String p_sSuffix) throws Exception
{
String sSuffix = (null == p_sSuffix) ? "*" : "*" + p_sSuffix;
- return m_oConn.dir(sSuffix);
+
+ try
+ {
+ return m_oConn.dir(sSuffix);
+ }
+ catch (Exception ex)
+ {
+ // TODO better error handling. Assume no such file or directory.
+
+ return null;
+ }
}
/*
@@ -313,7 +335,7 @@
m_oConn.setRemoteHost(m_sFtpServer);
} catch (UnknownHostException ex)
{
- ex.printStackTrace();
+// ex.printStackTrace();
throw ex;
}
More information about the jboss-svn-commits
mailing list