You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by am...@apache.org on 2008/05/06 13:14:22 UTC

svn commit: r653745 - /webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/WSDL2Code.java

Author: amilas
Date: Tue May  6 04:14:22 2008
New Revision: 653745

URL: http://svn.apache.org/viewvc?rev=653745&view=rev
Log:
refactored the code to remove the system.exit(0)

Modified:
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/WSDL2Code.java

Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/WSDL2Code.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/WSDL2Code.java?rev=653745&r1=653744&r2=653745&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/WSDL2Code.java (original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/WSDL2Code.java Tue May  6 04:14:22 2008
@@ -31,9 +31,11 @@
     public static void main(String[] args) throws Exception {
         CommandLineOptionParser commandLineOptionParser = new CommandLineOptionParser(
                 args);
-        validateCommandLineOptions(commandLineOptionParser);
-        new CodeGenerationEngine(commandLineOptionParser).generate();
-
+        if (isOptionsValid(commandLineOptionParser)){
+            new CodeGenerationEngine(commandLineOptionParser).generate();
+        } else {
+            printUsage();
+        }
     }
 
     private static void printUsage() {
@@ -43,19 +45,19 @@
         for (int i = 2; i <= 45; i++) {
             System.out.println("  " + CodegenMessages.getMessage("wsdl2code.arg" + i));
         }
-        System.exit(0);//$NON-SEC-2
     }
 
 
-    private static void validateCommandLineOptions(
-            CommandLineOptionParser parser) {
-        if (parser.getInvalidOptions(new WSDL2JavaOptionsValidator()).size() > 0)
-            printUsage();
-        if (null ==
-                parser.getAllOptions().get(
-                        CommandLineOptionConstants.WSDL2JavaConstants.WSDL_LOCATION_URI_OPTION))
-            printUsage();
+    private static boolean isOptionsValid(CommandLineOptionParser parser) {
+        boolean isValid = true;
+        if (parser.getInvalidOptions(new WSDL2JavaOptionsValidator()).size() > 0){
+            isValid = false;
+        }
+        if (null == parser.getAllOptions().get(
+                        CommandLineOptionConstants.WSDL2JavaConstants.WSDL_LOCATION_URI_OPTION)){
+            isValid = false;
+        }
+        return isValid;
     }
 
-
 }



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