You are viewing a plain text version of this content. The canonical link for it is here.
Posted to woden-dev@ws.apache.org by jk...@apache.org on 2005/10/08 18:25:46 UTC

svn commit: r307307 - /incubator/woden/java/src/org/apache/woden/WSDLFactory.java

Author: jkaputin
Date: Sat Oct  8 09:25:40 2005
New Revision: 307307

URL: http://svn.apache.org/viewcvs?rev=307307&view=rev
Log:
Improved the error handling.

Modified:
    incubator/woden/java/src/org/apache/woden/WSDLFactory.java

Modified: incubator/woden/java/src/org/apache/woden/WSDLFactory.java
URL: http://svn.apache.org/viewcvs/incubator/woden/java/src/org/apache/woden/WSDLFactory.java?rev=307307&r1=307306&r2=307307&view=diff
==============================================================================
--- incubator/woden/java/src/org/apache/woden/WSDLFactory.java (original)
+++ incubator/woden/java/src/org/apache/woden/WSDLFactory.java Sat Oct  8 09:25:40 2005
@@ -17,6 +17,7 @@
 
 import java.io.File;
 import java.io.FileInputStream;
+import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.util.Properties;
 
@@ -61,29 +62,28 @@
             }
             catch (Exception e)
             {
-                /*TODO decide how to handle exceptions
-                 Catches:
+                /*
+                 Catches and wraps:
                  ClassNotFoundException
                  InstantiationException
                  IllegalAccessException
                  */
                 
                 throw new WSDLException(WSDLException.CONFIGURATION_ERROR,
-                        "Problem instantiating factory " +
-                        "implementation.",
+                        "Problem instantiating a WSDLFactory implementation " +
+                        "using factory impl name '" + factoryImplName + "' ",
                         e);
             }
         }
         else
         {
             throw new WSDLException(WSDLException.CONFIGURATION_ERROR,
-                    "Unable to find name of factory implementation.");
+                    "Unable to find the name of a WSDLFactory implementation class.");
         }
     }
     
-    private static String findFactoryImplName() {
-        
-        
+    private static String findFactoryImplName() throws WSDLException
+    {
         String factoryImplName = null;
 
         // First, check the system property.
@@ -98,13 +98,13 @@
         }
         catch (SecurityException e)
         {
-            //TODO empty catch block copied from wsdl4j. Necessary?
+            //TODO empty catch block copied from wsdl4j. Decide if OK to ignore?
         }
 
         // Second, check /META-INF/services
         //TODO put code here to check for factory impl name property in /META...
         
-        // Third, check the properties file.
+        // Third, check for a properties file on the system path.
         String propFileName = getFullPropertyFileName();
 
         if (propFileName != null)
@@ -124,10 +124,32 @@
             {
               return factoryImplName;
             }
+          } 
+          catch (FileNotFoundException e1) 
+          {
+            // This just means no properties file was found. OK to ignore.
           }
           catch (IOException e)
           {
-              //TODO empty catch block copied from wsdl4j. Necessary?
+              /*
+               * thrown by Properties.load if an error occurred when reading 
+               * from the input stream.
+               */
+              throw new WSDLException(WSDLException.CONFIGURATION_ERROR,
+                      "Problem loading the properties file '" +
+                      propFileName + "' ",
+                      e);
+          }
+          catch (IllegalArgumentException e)
+          {
+              /*
+               * thrown by Properties.load if the input stream contains a 
+               * malformed Unicode escape sequence. 
+               */
+              throw new WSDLException(WSDLException.CONFIGURATION_ERROR,
+                      "Problem with the content of the properties file '" +
+                      propFileName + "' ",
+                      e);
           }
         }
 
@@ -149,7 +171,7 @@
             }
             catch (SecurityException e)
             {
-                //TODO empty catch block copied from wsdl4j. Necessary?
+                //TODO empty catch block copied from wsdl4j. Decide if OK to ignore?
             }
         }
         



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