Author: dims
Date: Thu Jun  7 14:38:44 2007
New Revision: 545322

URL: http://svn.apache.org/viewvc?view=rev&rev=545322
Log:
Fix for AXIS2-2779 - The -xc cmdline option of Java2WSDL takes into account 
only the last class specified

Modified:
    
webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/utils/Java2WSDLCommandLineOptionParser.java

Modified: 
webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/utils/Java2WSDLCommandLineOptionParser.java
URL: 
http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/utils/Java2WSDLCommandLineOptionParser.java?view=diff&rev=545322&r1=545321&r2=545322
==============================================================================
--- 
webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/utils/Java2WSDLCommandLineOptionParser.java
 (original)
+++ 
webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/utils/Java2WSDLCommandLineOptionParser.java
 Thu Jun  7 14:38:44 2007
@@ -78,7 +78,6 @@
                     state = NEW_OPTION;
                     optionType = args[i];
                     optionBundle = null;
-
                 }
             } else {
                 if (STARTED == state) {
@@ -91,10 +90,16 @@
                     return commandLineOptions;
 
                 } else if (NEW_OPTION == state) {
-                    optionBundle = new ArrayList();
-                    optionBundle.add(args[i]);
-                    state = SUB_PARAM_OF_OPTION;
-
+                    Java2WSDLCommandLineOption old = 
(Java2WSDLCommandLineOption)commandLineOptions.get(getOptionType(optionType));
+                    if(old !=null){
+                        old.getOptionValues().add(args[i]);
+                        optionBundle = null;
+                        state = STARTED;
+                    } else {
+                        optionBundle = new ArrayList();
+                        optionBundle.add(args[i]);
+                        state = SUB_PARAM_OF_OPTION;
+                    }
                 } else if (SUB_PARAM_OF_OPTION == state) {
                     optionBundle.add(args[i]);
                 }
@@ -104,9 +109,18 @@
 
         }
 
-        commandLineOption = new Java2WSDLCommandLineOption(optionType, 
optionBundle);
-        commandLineOptions.put(commandLineOption.getOptionType(), 
commandLineOption);
+        if(state != STARTED) { 
+            commandLineOption = new Java2WSDLCommandLineOption(optionType, 
optionBundle);
+            commandLineOptions.put(commandLineOption.getOptionType(), 
commandLineOption);
+        }
         return commandLineOptions;
+    }
+
+    private String getOptionType(String type) {
+        //cater for the long options first
+        if (type.startsWith("--")) type = type.replaceFirst("--", "");
+        if (type.startsWith("-")) type = type.replaceFirst("-", "");
+        return type;
     }
 
     public Map getAllOptions() {



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to