apache.commons.net ParserInitializationException
We use the jakarta/apache (don't know what they call it these days) commons net jar as our ftp client and this seems to be failing with a TANDEM ftp box. Looks like someone else was running into the same error at about the same time.
This is the error I was running into:
org.apache.commons.net.ftp.parser.ParserInitializationException:
Error initializing parser at org.apache.commons.net.ftp.parser.DefaultFTPFileEntryParserFactory.
createFileEntryParser(DefaultFTPFileEntryParserFactory.java:115) at org.apache.commons.net.ftp.FTPClient.
initiateListParsing(FTPClient.java:2306) at org.apache.commons.net.ftp.FTPClient.listFiles(FTPClient.java:2055) at org.apache.commons.net.ftp.FTPClient.listFiles(FTPClient.java:2106) at org.apache.commons.net.ftp.FTPClient.listFiles(FTPClient.java:2146)
After taking a look at the commons code, here's what I figured out, the TANDEM box was returning
an empty string on a FTP SYST command. Our good people at commons don't handle a null, assuming
the FTPClient.getSystemName() always returns something. So here's my hack to get around it.
if(null == ftpClient.getSystemName()) {
//use parserKey,pathName method signature
ftpFileArray = ftpClient.listFiles("UNIX",(String)null);
} else {
ftpFileArray = ftpClient.listFiles();
}
This is the error I was running into:
org.apache.commons.net.ftp.parser.ParserInitializationException:
Error initializing parser at org.apache.commons.net.ftp.parser.DefaultFTPFileEntryParserFactory.
createFileEntryParser(DefaultFTPFileEntryParserFactory.java:115) at org.apache.commons.net.ftp.FTPClient.
initiateListParsing(FTPClient.java:2306) at org.apache.commons.net.ftp.FTPClient.listFiles(FTPClient.java:2055) at org.apache.commons.net.ftp.FTPClient.listFiles(FTPClient.java:2106) at org.apache.commons.net.ftp.FTPClient.listFiles(FTPClient.java:2146)
After taking a look at the commons code, here's what I figured out, the TANDEM box was returning
an empty string on a FTP SYST command. Our good people at commons don't handle a null, assuming
the FTPClient.getSystemName() always returns something. So here's my hack to get around it.
if(null == ftpClient.getSystemName()) {
//use parserKey,pathName method signature
ftpFileArray = ftpClient.listFiles("UNIX",(String)null);
} else {
ftpFileArray = ftpClient.listFiles();
}

