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 di...@apache.org on 2006/05/01 17:30:29 UTC
svn commit: r398623 -
/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodegenConfigLoader.java
Author: dims
Date: Mon May 1 08:30:28 2006
New Revision: 398623
URL: http://svn.apache.org/viewcvs?rev=398623&view=rev
Log:
Fix for AXIS2-651 (If there is no '=' in the value for ns2p, then try loading it as a file)
Modified:
webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodegenConfigLoader.java
Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodegenConfigLoader.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodegenConfigLoader.java?rev=398623&r1=398622&r2=398623&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodegenConfigLoader.java (original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodegenConfigLoader.java Mon May 1 08:30:28 2006
@@ -5,9 +5,12 @@
import org.apache.axis2.wsdl.util.CommandLineOptionConstants;
import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
+import java.util.Properties;
/*
* Copyright 2004,2005 The Apache Software Foundation.
*
@@ -108,17 +111,29 @@
//to be a comma seperated list with uri,packagename,uri,packagename...
String value = ns2packageOption.getOptionValue();
if (value != null) {
- String valuepairs[] = value.split(",");
- if (valuepairs.length > 0) {
- //put them in the hash map
- HashMap map = new HashMap(valuepairs.length);
- for (int i = 0; i < valuepairs.length; i++) {
- String values[] = valuepairs[i].split("=");
- if(values.length == 2) {
- map.put(values[0], values[1]);
+ // Try treating the values as a name=value pair separated by comma's
+ if (value.indexOf('=') != -1) {
+ String valuepairs[] = value.split(",");
+ if (valuepairs.length > 0) {
+ //put them in the hash map
+ HashMap map = new HashMap(valuepairs.length);
+ for (int i = 0; i < valuepairs.length; i++) {
+ String values[] = valuepairs[i].split("=");
+ if (values.length == 2) {
+ map.put(values[0], values[1]);
+ }
}
+ config.setUri2PackageNameMap(map);
+ }
+ } else {
+ // Try loading the properties from the file specified
+ try {
+ Properties p = new Properties();
+ p.load(new FileInputStream(value));
+ config.setUri2PackageNameMap(p);
+ } catch (IOException e) {
+ throw new RuntimeException("Unable to load file :" + value, e);
}
- config.setUri2PackageNameMap(map);
}
}
}