commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sco...@apache.org
Subject svn commit: r365822 - /jakarta/commons/proper/net/trunk/src/java/org/apache/commons/net/ftp/parser/DefaultFTPFileEntryParserFactory.java
Date Wed, 04 Jan 2006 04:26:53 GMT
Author: scohen
Date: Tue Jan  3 20:26:40 2006
New Revision: 365822

URL: http://svn.apache.org/viewcvs?rev=365822&view=rev
Log:
Provide some further guidance to perplexed users who don't realize 
that the dependency on jakarta-oro exists, by catching the 
NoClassDefFoundError that is thrown when this happens, and wrap it in
an exception that explicitly tells user to put this jar on classpath.

In response to bug 38055

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

Modified: jakarta/commons/proper/net/trunk/src/java/org/apache/commons/net/ftp/parser/DefaultFTPFileEntryParserFactory.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/net/trunk/src/java/org/apache/commons/net/ftp/parser/DefaultFTPFileEntryParserFactory.java?rev=365822&r1=365821&r2=365822&view=diff
==============================================================================
--- jakarta/commons/proper/net/trunk/src/java/org/apache/commons/net/ftp/parser/DefaultFTPFileEntryParserFactory.java
(original)
+++ jakarta/commons/proper/net/trunk/src/java/org/apache/commons/net/ftp/parser/DefaultFTPFileEntryParserFactory.java
Tue Jan  3 20:26:40 2006
@@ -84,38 +84,60 @@
         }
         catch (ClassNotFoundException e)
         {
-            String ukey = null;
-            if (null != key)
+            try 
             {
-                ukey = key.toUpperCase();
-            }
-            if (ukey.indexOf(FTPClientConfig.SYST_UNIX) >= 0)
-            {
-                parser = createUnixFTPEntryParser();
-            }
-            else if (ukey.indexOf(FTPClientConfig.SYST_VMS) >= 0)
-            {
-                parser = createVMSVersioningFTPEntryParser();
-            }
-            else if (ukey.indexOf(FTPClientConfig.SYST_NT) >= 0)
-            {
-                parser = createNTFTPEntryParser();
-            }
-            else if (ukey.indexOf(FTPClientConfig.SYST_OS2) >= 0)
-            {
-                parser = createOS2FTPEntryParser();
-            }
-            else if (ukey.indexOf(FTPClientConfig.SYST_OS400) >= 0)
-            {
-                parser = createOS400FTPEntryParser();
-            }
-            else if (ukey.indexOf(FTPClientConfig.SYST_MVS) >= 0)
-            {
-                parser = createMVSEntryParser();
-        	}
-            else
-            {
-                throw new ParserInitializationException("Unknown parser type: " + key);
+	            String ukey = null;
+	            if (null != key)
+	            {
+	                ukey = key.toUpperCase();
+	            }
+	            if (ukey.indexOf(FTPClientConfig.SYST_UNIX) >= 0)
+	            {
+	                parser = createUnixFTPEntryParser();
+	            }
+	            else if (ukey.indexOf(FTPClientConfig.SYST_VMS) >= 0)
+	            {
+	                parser = createVMSVersioningFTPEntryParser();
+	            }
+	            else if (ukey.indexOf(FTPClientConfig.SYST_NT) >= 0)
+	            {
+	                parser = createNTFTPEntryParser();
+	            }
+	            else if (ukey.indexOf(FTPClientConfig.SYST_OS2) >= 0)
+	            {
+	                parser = createOS2FTPEntryParser();
+	            }
+	            else if (ukey.indexOf(FTPClientConfig.SYST_OS400) >= 0)
+	            {
+	                parser = createOS400FTPEntryParser();
+	            }
+	            else if (ukey.indexOf(FTPClientConfig.SYST_MVS) >= 0)
+	            {
+	                parser = createMVSEntryParser();
+	        	}
+	            else
+	            {
+	                throw new ParserInitializationException("Unknown parser type: " + key);
+	            }
+            } 
+            catch (NoClassDefFoundError nf)
+            { 	
+                if (nf.getMessage().startsWith("org/apache/oro")) {
+    	            throw new ParserInitializationException(
+    	                " jakarta-oro-2.x.jar required on the runtime classpath. ", nf);
+                } else {
+                    throw new ParserInitializationException("Error initializing parser",
nf);
+                }
+            }
+
+        }
+        catch (NoClassDefFoundError e)
+        { 	
+            if (e.getMessage().startsWith("org/apache/oro")) {
+	            throw new ParserInitializationException(
+	                " jakarta-oro-2.x.jar required on the runtime classpath. ", e);
+            } else {
+                throw new ParserInitializationException("Error initializing parser", e);
             }
         }
         catch (ClassCastException e)



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message