reverted previous commit
git-svn-id: https://svn.apache.org/repos/asf/servicemix/smx3/tags/servicemix-3.2.3@725387 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/deployables/bindingcomponents/servicemix-ftp/src/main/java/org/apache/servicemix/ftp/FtpPollerEndpoint.java b/deployables/bindingcomponents/servicemix-ftp/src/main/java/org/apache/servicemix/ftp/FtpPollerEndpoint.java
index 6460423..f525b8e 100644
--- a/deployables/bindingcomponents/servicemix-ftp/src/main/java/org/apache/servicemix/ftp/FtpPollerEndpoint.java
+++ b/deployables/bindingcomponents/servicemix-ftp/src/main/java/org/apache/servicemix/ftp/FtpPollerEndpoint.java
@@ -272,7 +272,7 @@
}
});
}
-
+
protected boolean processFileAndDelete(String file) {
FTPClient ftp = null;
boolean unlock = true;
@@ -281,7 +281,7 @@
if (logger.isDebugEnabled()) {
logger.debug("Processing file " + file);
}
- if (isFileExistingOnServer(ftp, file)) {
+ if (ftp.listFiles(file).length > 0) {
// Process the file. If processing fails, an exception should be thrown.
processFile(ftp, file);
// Processing is successful
@@ -305,36 +305,6 @@
return unlock;
}
- /**
- * checks if file specified exists on server
- *
- * @param ftp the ftp client
- * @param file the full file path
- * @return true if found on server
- */
- private boolean isFileExistingOnServer(FTPClient ftp, String file) throws IOException {
- boolean foundFile = false;
- int lastIndex = file.lastIndexOf("/");
- String directory = ".";
- String rawName = file;
- if (lastIndex > 0) {
- directory = file.substring(0, lastIndex);
- rawName = file.substring(lastIndex + 1);
- }
-
- FTPFile[] files = listFiles(ftp, directory);
- if (files.length > 0) {
- for (FTPFile f : files) {
- if (f.getName().equals(rawName)) {
- foundFile = true;
- break;
- }
- }
- }
-
- return foundFile;
- }
-
protected void processFile(FTPClient ftp, String file) throws Exception {
InputStream in = ftp.retrieveFileStream(file);
InOnly exchange = getExchangeFactory().createInOnlyExchange();