You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by di...@apache.org on 2007/06/28 23:29:24 UTC
svn commit: r551707 -
/webservices/axis2/trunk/java/modules/xmlbeans/src/org/apache/axis2/xmlbeans/CodeGenerationUtility.java
Author: dims
Date: Thu Jun 28 14:29:23 2007
New Revision: 551707
URL: http://svn.apache.org/viewvc?view=rev&rev=551707
Log:
Fix for AXIS2-1885 - WSDL2Java with XMLBeans binding codegen fails with 'Duplicate global type' when schema is imported from WSDL file and another schema file.
Modified:
webservices/axis2/trunk/java/modules/xmlbeans/src/org/apache/axis2/xmlbeans/CodeGenerationUtility.java
Modified: webservices/axis2/trunk/java/modules/xmlbeans/src/org/apache/axis2/xmlbeans/CodeGenerationUtility.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/xmlbeans/src/org/apache/axis2/xmlbeans/CodeGenerationUtility.java?view=diff&rev=551707&r1=551706&r2=551707
==============================================================================
--- webservices/axis2/trunk/java/modules/xmlbeans/src/org/apache/axis2/xmlbeans/CodeGenerationUtility.java (original)
+++ webservices/axis2/trunk/java/modules/xmlbeans/src/org/apache/axis2/xmlbeans/CodeGenerationUtility.java Thu Jun 28 14:29:23 2007
@@ -607,10 +607,18 @@
XmlSchema schema = schemas[i];
if (schema.getSourceURI() != null &&
schema.getSourceURI().endsWith(systemId.replaceAll("\\\\", "/"))) {
- try {
- return new InputSource(getSchemaAsReader(schemas[i]));
- } catch (IOException e) {
- throw new RuntimeException(e);
+ String path = schema.getSourceURI();
+ File f = getFileFromURI(path);
+ if(f.exists()){
+ InputSource source = new InputSource();
+ source.setSystemId(schema.getSourceURI());
+ return source;
+ } else {
+ try {
+ return new InputSource(getSchemaAsReader(schemas[i]));
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
}
}
@@ -632,12 +640,25 @@
//constructor, the context URL scheme should be ignored
baseUri = (baseUri == null) ? "file:///" : baseUri;
URL url = new URL(baseUri + systemId);
- return new InputSource(url.openStream());
+ InputSource source = new InputSource();
+ source.setSystemId(url.toString());
+ return source;
}
return XMLUtils.getEmptyInputSource();
} catch (Exception e) {
throw new SAXException(e);
}
+ }
+
+ private File getFileFromURI(String path) {
+ if(path.startsWith("file:///")){
+ path = path.substring(8);
+ } else if(path.startsWith("file://")){
+ path = path.substring(7);
+ } else if(path.startsWith("file:/")){
+ path = path.substring(6);
+ }
+ return new File(path);
}
public XmlSchema[] getSchemas() {
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org