[
https://issues.jboss.org/browse/JBESB-3798?page=com.atlassian.jira.plugin...
]
Tom Cunningham resolved JBESB-3798.
-----------------------------------
Resolution: Done
Use listFiles rather than listNames so directories are omitted from the file list.
Ftp Provider is processing sub-directories in loop when input-suffix
is not specified
-------------------------------------------------------------------------------------
Key: JBESB-3798
URL:
https://issues.jboss.org/browse/JBESB-3798
Project: JBoss ESB
Issue Type: Bug
Security Level: Public(Everyone can see)
Components: Adapters
Affects Versions: 4.11 CP1
Reporter: Tom Cunningham
Assignee: Tom Cunningham
Fix For: 4.11 CP1
From Vinicius :
When input-suffix is not specified on ftp-message-filter property of
ftp-provider, the ESB will try to process all files and folders, therefore, the
process will become in loop.
How reproducible:
Easy
Steps to Reproduce:
1. Setup a Ftp Server;
2. Create a directory structure similar as follows:
<ROOT_FOLDER>
|
|----<SUB_FOLDER_1>
|----<SUB_FOLDER_2>
3.Create an ESB project with a similar ftp-provider configuration as follows:
<ftp-provider name="<name>"
hostname="<hostname>">
<ftp-bus busid="<busIdname>" >
<ftp-message-filter
protocol="ftp"
username="<user>"
password="<PASS>"
input-suffix=""
directory=""
post-directory="<SUB_FOLDER_1>"
error-directory="<SUB_FOLDER_2>"/>
</ftp-bus>
</ftp-provider>
<services>
<service category="myCategory" description="Hello World File
Action (esb
listener)" name="myFileListener" invmScope="GLOBAL">
<listeners>
<ftp-listener busidref="helloFTPChannel" is-gateway="true"
name="FtpGateway" scheduleidref="1-sec-trigger" />
</listeners>
<actions mep="OneWay">
<action class="org.jboss.soa.esb.actions.SystemPrintln"
name="print-after">
<property name="message" value="Message after!" />
</action>
</actions>
</service>
</services>
Actual results:
All files and sub-folders will be processed in loop;
All files and sub-folders will be renamed in loop. Example:
README.txt.esbWorking.esbWorking.esbWorking.esbWorking.esbWorking.esbWorking
Expected results:
Only files should be processed.
Additional Info:
Our current Ftp implementation org.jboss.internal.soa.esb.util.FtpImpl [1], has
the following method to list remote files:
protected FTPClient m_oConn ; *Apache FTp Client - commons-net-2.0.jar
public String[] getFileListFromRemoteDir (String p_sSuffix)
throws RemoteFileSystemException, IOException
{
String sSuffix = (null == p_sSuffix) ? "*" : "*" + p_sSuffix;
try
{
changeRemoteDirectory() ;
return m_oConn.listNames(sSuffix) ;
}
catch (final IOException ioe)
{
throw new RemoteFileSystemException(ioe) ;
}
}
As we can see, we're using the "listNames()" [2] method, which returns
all
files and folders within the current directory.
Furthermore, this class provides a "listFiles()" [3] method which returns an
array of FtpFile [4] objects, and finally, has methods to validate whether
we're dealing with a file or a folder as well - isFile() [5] / isDirectory()
[6]
Links:
[1] -
http://anonsvn.jboss.org/repos/labs/labs/jbossesb/tags/JBESB_4_7_CP1_ER10...
[2] -
http://commons.apache.org/net/api-3.1/org/apache/commons/net/ftp/FTPClien...
[3] -
http://commons.apache.org/net/api-3.1/org/apache/commons/net/ftp/FTPClien...
[4] -
http://commons.apache.org/net/api-3.1/org/apache/commons/net/ftp/FTPFile....
[5] -
http://commons.apache.org/net/api-3.1/org/apache/commons/net/ftp/FTPFile....
[6] -
http://commons.apache.org/net/api-3.1/org/apache/commons/net/ftp/FTPFile....
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see:
http://www.atlassian.com/software/jira