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 2007/08/02 11:53:25 UTC

svn commit: r562057 - /webservices/axis2/branches/java/1_3/modules/xmlbeans/src/org/apache/axis2/xmlbeans/CodeGenerationUtility.java

Author: dims
Date: Thu Aug  2 02:53:25 2007
New Revision: 562057

URL: http://svn.apache.org/viewvc?view=rev&rev=562057
Log:
Merge fix for AXIS2-3036 - 'Duplicate global type' when importing the same xsd from two other xsd's from trunk

Modified:
    webservices/axis2/branches/java/1_3/modules/xmlbeans/src/org/apache/axis2/xmlbeans/CodeGenerationUtility.java

Modified: webservices/axis2/branches/java/1_3/modules/xmlbeans/src/org/apache/axis2/xmlbeans/CodeGenerationUtility.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_3/modules/xmlbeans/src/org/apache/axis2/xmlbeans/CodeGenerationUtility.java?view=diff&rev=562057&r1=562056&r2=562057
==============================================================================
--- webservices/axis2/branches/java/1_3/modules/xmlbeans/src/org/apache/axis2/xmlbeans/CodeGenerationUtility.java (original)
+++ webservices/axis2/branches/java/1_3/modules/xmlbeans/src/org/apache/axis2/xmlbeans/CodeGenerationUtility.java Thu Aug  2 02:53:25 2007
@@ -61,6 +61,9 @@
 import java.io.StringReader;
 import java.io.StringWriter;
 import java.io.Writer;
+import java.io.InputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.ByteArrayInputStream;
 import java.net.URL;
 import java.util.ArrayList;
 import java.util.Arrays;
@@ -619,11 +622,7 @@
                             source.setSystemId(schema.getSourceURI());
                             return source;
                         } else {
-                            try {
-                                return new InputSource(getSchemaAsReader(schemas[i]));
-                            } catch (IOException e) {
-                                throw new RuntimeException(e);
-                            }
+                            return new InputSource(getSchemaAsInputStream(schemas[i]));
                         }
                     }
 
@@ -632,11 +631,7 @@
                     XmlSchema schema = schemas[i];
                     if (schema.getTargetNamespace() != null &&
                             schema.getTargetNamespace().equals(publicId)) {
-                        try {
-                            return new InputSource(getSchemaAsReader(schemas[i]));
-                        } catch (IOException e) {
-                            throw new RuntimeException(e);
-                        }
+                        return new InputSource(getSchemaAsInputStream(schemas[i]));
                     }
                 }
                 if (systemId.indexOf(':') == -1) {
@@ -687,11 +682,10 @@
          *
          * @param schema
          */
-        private StringReader getSchemaAsReader(XmlSchema schema) throws IOException {
-            StringWriter writer = new StringWriter();
-            schema.write(writer);
-            writer.flush();
-            return new StringReader(writer.toString());
+        private InputStream getSchemaAsInputStream(XmlSchema schema){
+         ByteArrayOutputStream baos = new ByteArrayOutputStream();
+         schema.write(baos);
+         return new ByteArrayInputStream(baos.toByteArray());
         }
     }
 



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