Author: veithen
Date: Mon Mar 22 23:04:27 2010
New Revision: 926384
URL: http://svn.apache.org/viewvc?rev=926384&view=rev
Log:
AXIS2-4660: Added a syntax check for the p2n option.
Modified:
axis/axis2/java/core/trunk/modules/java2wsdl/src/org/apache/ws/java2wsdl/Java2WSDLCodegenEngine.java
Modified:
axis/axis2/java/core/trunk/modules/java2wsdl/src/org/apache/ws/java2wsdl/Java2WSDLCodegenEngine.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/java2wsdl/src/org/apache/ws/java2wsdl/Java2WSDLCodegenEngine.java?rev=926384&r1=926383&r2=926384&view=diff
==============================================================================
---
axis/axis2/java/core/trunk/modules/java2wsdl/src/org/apache/ws/java2wsdl/Java2WSDLCodegenEngine.java
(original)
+++
axis/axis2/java/core/trunk/modules/java2wsdl/src/org/apache/ws/java2wsdl/Java2WSDLCodegenEngine.java
Mon Mar 22 23:04:27 2010
@@ -263,7 +263,7 @@ public class Java2WSDLCodegenEngine impl
}
- protected Map<String,String>
loadJavaPkg2NamespaceMap(Java2WSDLCommandLineOption option)
+ protected Map<String,String>
loadJavaPkg2NamespaceMap(Java2WSDLCommandLineOption option) throws Exception
{
Map<String,String> pkg2nsMap = new Hashtable<String,String>();
if (option != null)
@@ -277,8 +277,14 @@ public class Java2WSDLCodegenEngine impl
//an option value will be of the form [java package, namespace]
//hence we take the two substrings starting after '[' and upto
',' and
//starting after ',' and upto ']'
- pkg2nsMap.put(anOptionValue.substring(1,
anOptionValue.indexOf(COMMA)).trim(),
-
anOptionValue.substring(anOptionValue.indexOf(COMMA) + 1,
anOptionValue.length() - 1).trim());
+ if (anOptionValue.charAt(0) == '[' &&
anOptionValue.charAt(anOptionValue.length()-1) == ']') {
+ pkg2nsMap.put(anOptionValue.substring(1,
anOptionValue.indexOf(COMMA)).trim(),
+
anOptionValue.substring(anOptionValue.indexOf(COMMA) + 1,
anOptionValue.length() - 1).trim());
+ } else {
+ throw new Exception("Invalid syntax for the " +
Java2WSDLConstants.JAVA_PKG_2_NSMAP_OPTION
+ + " (" +
Java2WSDLConstants.JAVA_PKG_2_NSMAP_OPTION_LONG
+ + ") option; must be [package,namespace]");
+ }
}
}
return pkg2nsMap;