[jboss-svn-commits] JBL Code SVN: r15043 - labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/couriers/helpers.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Wed Sep 12 05:00:44 EDT 2007
Author: kevin.conner at jboss.com
Date: 2007-09-12 05:00:44 -0400 (Wed, 12 Sep 2007)
New Revision: 15043
Modified:
labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/couriers/helpers/FtpFileHandler.java
Log:
Close handlers after use: JBESB-748
Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/couriers/helpers/FtpFileHandler.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/couriers/helpers/FtpFileHandler.java 2007-09-12 08:28:05 UTC (rev 15042)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/couriers/helpers/FtpFileHandler.java 2007-09-12 09:00:44 UTC (rev 15043)
@@ -107,9 +107,10 @@
// TODO would be better to return false if the file did not exist and leave exceptions
// for other error conditions (such as permission denied).
+ final RemoteFileSystem handler = getHandler() ;
try
{
- getHandler().deleteRemoteFile(file.getName());
+ handler.deleteRemoteFile(file.getName());
return true;
}
catch (Exception e)
@@ -118,6 +119,10 @@
throw new CourierException(e);
}
+ finally
+ {
+ handler.quit() ;
+ }
}
public byte[] getFileContents(File file) throws CourierException
@@ -139,7 +144,15 @@
return null;
}
- getHandler().downloadFile(name, name);
+ final RemoteFileSystem handler = getHandler() ;
+ try
+ {
+ handler.downloadFile(name, name);
+ }
+ finally
+ {
+ handler.quit() ;
+ }
File local = new File(_localDir, name);
byte[] ba = CourierUtil.bytesFromLocalFile(local);
local.delete();
@@ -161,7 +174,15 @@
try
{
String name = file.getName();
- getHandler().uploadFile(file, name);
+ final RemoteFileSystem handler = getHandler() ;
+ try
+ {
+ handler.uploadFile(file, name);
+ }
+ finally
+ {
+ handler.quit();
+ }
file.delete();
}
catch (Exception e)
@@ -179,7 +200,15 @@
try
{
String name = file.getName();
- getHandler().downloadFile(name, name);
+ final RemoteFileSystem handler = getHandler() ;
+ try
+ {
+ handler.downloadFile(name, name);
+ }
+ finally
+ {
+ handler.quit() ;
+ }
return new File(_localDir,name);
}
catch (Exception e)
@@ -192,10 +221,10 @@
{
String[] names = null;
+ final RemoteFileSystem handler = getHandler() ;
try
{
- names = getHandler()
- .getFileListFromRemoteDir(_epr.getInputSuffix());
+ names = handler.getFileListFromRemoteDir(_epr.getInputSuffix());
}
catch (Exception e)
{
@@ -203,6 +232,10 @@
throw new CourierException(e);
}
+ finally
+ {
+ handler.quit() ;
+ }
if (null == names)
return null;
@@ -216,9 +249,10 @@
public boolean renameFile(File from, File to) throws CourierException
{
+ final RemoteFileSystem handler = getHandler() ;
try
{
- getHandler().remoteRename(from, to);
+ handler.remoteRename(from, to);
return true;
}
@@ -230,6 +264,10 @@
{
throw new CourierException(e);
}
+ finally
+ {
+ handler.quit();
+ }
}
// Because ftp connections are volatile, we are always getting a fresh
More information about the jboss-svn-commits
mailing list