commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1022904 - /commons/proper/net/trunk/src/main/java/org/apache/commons/net/ftp/parser/DefaultFTPFileEntryParserFactory.java
Date Fri, 15 Oct 2010 13:06:19 GMT
Author: sebb
Date: Fri Oct 15 13:06:18 2010
New Revision: 1022904

URL: http://svn.apache.org/viewvc?rev=1022904&view=rev
Log:
Avoid possible NPE warning by only catching CCE where it can occur

Modified:
    commons/proper/net/trunk/src/main/java/org/apache/commons/net/ftp/parser/DefaultFTPFileEntryParserFactory.java

Modified: commons/proper/net/trunk/src/main/java/org/apache/commons/net/ftp/parser/DefaultFTPFileEntryParserFactory.java
URL: http://svn.apache.org/viewvc/commons/proper/net/trunk/src/main/java/org/apache/commons/net/ftp/parser/DefaultFTPFileEntryParserFactory.java?rev=1022904&r1=1022903&r2=1022904&view=diff
==============================================================================
--- commons/proper/net/trunk/src/main/java/org/apache/commons/net/ftp/parser/DefaultFTPFileEntryParserFactory.java
(original)
+++ commons/proper/net/trunk/src/main/java/org/apache/commons/net/ftp/parser/DefaultFTPFileEntryParserFactory.java
Fri Oct 15 13:06:18 2010
@@ -86,7 +86,13 @@ public class DefaultFTPFileEntryParserFa
         try
         {
             parserClass = Class.forName(key);
-            parser = (FTPFileEntryParser) parserClass.newInstance();
+            try {
+                parser = (FTPFileEntryParser) parserClass.newInstance();
+            } catch (ClassCastException e) {
+                throw new ParserInitializationException(parserClass.getName()
+                    + " does not implement the interface "
+                    + "org.apache.commons.net.ftp.FTPFileEntryParser.", e);
+            }
         }
         catch (ClassNotFoundException e)
         {
@@ -142,12 +148,6 @@ public class DefaultFTPFileEntryParserFa
         {
             throw new ParserInitializationException("Error initializing parser", e);
         }
-        catch (ClassCastException e)
-        {
-            throw new ParserInitializationException(parserClass.getName()
-                + " does not implement the interface "
-                + "org.apache.commons.net.ftp.FTPFileEntryParser.", e);
-        }
         catch (Throwable e)
         {
             throw new ParserInitializationException("Error initializing parser", e);



Mime
View raw message