You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ode.apache.org by va...@apache.org on 2010/12/02 20:01:49 UTC

svn commit: r1041531 - in /ode/branches/ode-1.3.5.x: bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/wsdl/XMLSchemaTypeSerializer.java utils/src/main/java/org/apache/ode/utils/xsd/XSUtils.java

Author: vanto
Date: Thu Dec  2 19:01:48 2010
New Revision: 1041531

URL: http://svn.apache.org/viewvc?rev=1041531&view=rev
Log:
fixes ODE-891.

Modified:
    ode/branches/ode-1.3.5.x/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/wsdl/XMLSchemaTypeSerializer.java
    ode/branches/ode-1.3.5.x/utils/src/main/java/org/apache/ode/utils/xsd/XSUtils.java

Modified: ode/branches/ode-1.3.5.x/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/wsdl/XMLSchemaTypeSerializer.java
URL: http://svn.apache.org/viewvc/ode/branches/ode-1.3.5.x/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/wsdl/XMLSchemaTypeSerializer.java?rev=1041531&r1=1041530&r2=1041531&view=diff
==============================================================================
--- ode/branches/ode-1.3.5.x/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/wsdl/XMLSchemaTypeSerializer.java (original)
+++ ode/branches/ode-1.3.5.x/bpel-compiler/src/main/java/org/apache/ode/bpel/compiler/wsdl/XMLSchemaTypeSerializer.java Thu Dec  2 19:01:48 2010
@@ -22,6 +22,7 @@ import org.apache.ode.utils.DOMUtils;
 
 import java.io.PrintWriter;
 import java.io.Serializable;
+import java.io.UnsupportedEncodingException;
 
 import javax.wsdl.Definition;
 import javax.wsdl.WSDLException;
@@ -76,6 +77,12 @@ public class XMLSchemaTypeSerializer imp
                                          ExtensionRegistry extensionRegistry)
                                   throws WSDLException {
     DOMUtils.pancakeNamespaces(element);
-    return new XMLSchemaType(DOMUtils.domToString(element).getBytes());
+    try {
+        // xml dump is encoded in UTF-8, so the byte array should use the same encoding
+        // the reading xml parser should be able to correctly detect the encoding then.
+        return new XMLSchemaType(DOMUtils.domToString(element).getBytes("UTF-8"));
+    } catch (UnsupportedEncodingException e) {
+        throw new WSDLException(WSDLException.OTHER_ERROR, e.getMessage(), e);
+    }
   }
 }

Modified: ode/branches/ode-1.3.5.x/utils/src/main/java/org/apache/ode/utils/xsd/XSUtils.java
URL: http://svn.apache.org/viewvc/ode/branches/ode-1.3.5.x/utils/src/main/java/org/apache/ode/utils/xsd/XSUtils.java?rev=1041531&r1=1041530&r2=1041531&view=diff
==============================================================================
--- ode/branches/ode-1.3.5.x/utils/src/main/java/org/apache/ode/utils/xsd/XSUtils.java (original)
+++ ode/branches/ode-1.3.5.x/utils/src/main/java/org/apache/ode/utils/xsd/XSUtils.java Thu Dec  2 19:01:48 2010
@@ -30,14 +30,14 @@ import org.apache.xerces.xni.parser.XMLP
 import org.apache.xerces.xs.XSModel;
 import org.w3c.dom.ls.LSInput;
 
-import java.io.InputStream;
-import java.io.UnsupportedEncodingException;
+import java.io.ByteArrayInputStream;
 import java.net.URI;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
+
 /**
  * Various utility methods related to XML Schema processing.
  */
@@ -64,7 +64,7 @@ public class XSUtils {
 
         DOMInputImpl input = new DOMInputImpl();
         input.setSystemId(systemURI.toString());
-        input.setStringData(new String(schemaData));
+        input.setByteStream(new ByteArrayInputStream(schemaData));
 
         Map<URI, byte[]> ret = captureSchema(input, resolver);
         ret.put(systemURI, schemaData);