Repository: camel Updated Branches: refs/heads/camel-2.16.x 2ad57ce0d -> 6cb2fb254
CAMEL-10103: Camel FTP - Unknown parser type Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/6cb2fb25 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/6cb2fb25 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/6cb2fb25 Branch: refs/heads/camel-2.16.x Commit: 6cb2fb25469f17cfa95a033362b74c97c5bc1ed3 Parents: 2ad57ce Author: Arno Noordover <anoordo...@users.noreply.github.com> Authored: Wed Jun 29 23:25:53 2016 +0200 Committer: Arno Noordover <anoordo...@users.noreply.github.com> Committed: Thu Jun 30 06:20:00 2016 +0200 ---------------------------------------------------------------------- .../file/remote/OsgiParserFactory.java | 26 +++++++++++--------- 1 file changed, 14 insertions(+), 12 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/6cb2fb25/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/OsgiParserFactory.java ---------------------------------------------------------------------- diff --git a/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/OsgiParserFactory.java b/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/OsgiParserFactory.java index 6eaf87d..9b7db4d 100644 --- a/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/OsgiParserFactory.java +++ b/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/OsgiParserFactory.java @@ -94,31 +94,33 @@ public class OsgiParserFactory extends DefaultFTPFileEntryParserFactory { throw new ParserInitializationException(parserClass.getName() + " does not implement the interface " + "org.apache.commons.net.ftp.FTPFileEntryParser.", e); - } catch (Exception e) { - throw new ParserInitializationException("Error initializing parser", e); - } catch (ExceptionInInitializerError e) { + } catch (Exception | ExceptionInInitializerError e) { throw new ParserInitializationException("Error initializing parser", e); } } if (parser == null) { String ukey = key.toUpperCase(Locale.ENGLISH); - if (ukey.indexOf("UNIX") >= 0) { + if (ukey.contains("UNIX")) { + parser = new UnixFTPEntryParser(config); + } else if (ukey.contains("LINUX")) { parser = new UnixFTPEntryParser(config); - } else if (ukey.indexOf("VMS") >= 0) { + } else if (ukey.contains("VMS")) { parser = new VMSVersioningFTPEntryParser(config); - } else if (ukey.indexOf("WINDOWS") >= 0) { + } else if (ukey.contains("WINDOWS")) { + parser = createNTFTPEntryParser(config); + } else if (ukey.contains("WIN32")) { parser = createNTFTPEntryParser(config); - } else if (ukey.indexOf("OS/2") >= 0) { + } else if (ukey.contains("OS/2")) { parser = new OS2FTPEntryParser(config); - } else if ((ukey.indexOf("OS/400") >= 0) || (ukey.indexOf("AS/400") >= 0)) { + } else if ((ukey.contains("OS/400")) || (ukey.contains("AS/400"))) { parser = createOS400FTPEntryParser(config); - } else if (ukey.indexOf("MVS") >= 0) { + } else if (ukey.contains("MVS")) { parser = new MVSFTPEntryParser(); - } else if (ukey.indexOf("NETWARE") >= 0) { + } else if (ukey.contains("NETWARE")) { parser = new NetwareFTPEntryParser(config); - } else if (ukey.indexOf("MACOS PETER") >= 0) { + } else if (ukey.contains("MACOS PETER")) { parser = new MacOsPeterFTPEntryParser(config); - } else if (ukey.indexOf("TYPE: L8") >= 0) { + } else if (ukey.contains("TYPE: L8")) { parser = new UnixFTPEntryParser(config); } else { throw new ParserInitializationException("Unknown parser type: " + key);