[jbossws-commits] JBossWS SVN: r5243 - legacy/branches/jbossws-1.2.1.GA_CP/jbossws-core/src/java/org/jboss/ws/tools.

jbossws-commits at lists.jboss.org jbossws-commits at lists.jboss.org
Mon Dec 10 07:40:30 EST 2007


Author: heiko.braun at jboss.com
Date: 2007-12-10 07:40:30 -0500 (Mon, 10 Dec 2007)
New Revision: 5243

Modified:
   legacy/branches/jbossws-1.2.1.GA_CP/jbossws-core/src/java/org/jboss/ws/tools/WSTools.java
Log:
wstools error handling

Modified: legacy/branches/jbossws-1.2.1.GA_CP/jbossws-core/src/java/org/jboss/ws/tools/WSTools.java
===================================================================
--- legacy/branches/jbossws-1.2.1.GA_CP/jbossws-core/src/java/org/jboss/ws/tools/WSTools.java	2007-12-10 10:42:07 UTC (rev 5242)
+++ legacy/branches/jbossws-1.2.1.GA_CP/jbossws-core/src/java/org/jboss/ws/tools/WSTools.java	2007-12-10 12:40:30 UTC (rev 5243)
@@ -23,17 +23,17 @@
 
 // $Id$
 
+import org.jboss.logging.Logger;
+import org.jboss.ws.tools.config.ToolsSchemaConfigReader;
+import org.jboss.ws.tools.helpers.ToolsHelper;
+
 import java.io.File;
 import java.io.IOException;
+import java.io.PrintWriter;
 import java.net.URL;
 import java.net.URLClassLoader;
 import java.util.StringTokenizer;
 
-import org.jboss.logging.Logger;
-import org.jboss.ws.WSException;
-import org.jboss.ws.tools.config.ToolsSchemaConfigReader;
-import org.jboss.ws.tools.helpers.ToolsHelper;
-
 /**
  *  Main Class for WSTools
  *
@@ -55,7 +55,19 @@
    public static void main(String[] args) throws IOException
    {
       WSTools tools = new WSTools();
-      tools.generate(args);
+      boolean success = false;
+      try
+      {
+         success = tools.generate(args);
+      } catch (Throwable e)
+      {
+         e.printStackTrace( new PrintWriter(System.err) );         
+      }
+
+      if(success)
+         System.exit(0);
+      else
+         System.exit(1);
    }
 
    /**
@@ -111,8 +123,7 @@
          }
          else
          {
-            System.out.println("Usage: wstools (-classpath|-cp) <classpath> -config <config> [-dest <destination path>]");
-            System.exit(1);
+            throw new IOException("Usage: wstools (-classpath|-cp) <classpath> -config <config> [-dest <destination path>]");            
          }
       }
 
@@ -123,7 +134,7 @@
    {
       if (config == null)
          throw new IllegalArgumentException("Configuration is null");
-      
+
       if (outputDir == null)
          outputDir = ".";
       
@@ -138,7 +149,7 @@
       }
       else
       {
-         throw new WSException("Nothing done, Configuration source must have JavaToWSDL or WSDLToJava specified");
+         throw new IOException("Nothing done, Configuration source must have JavaToWSDL or WSDLToJava specified");
       }
       return true;
    }




More information about the jbossws-commits mailing list