changeset 288:973e0652e67f

7049699: Problem with xml/jax-ws
author andrew
date Wed, 28 Sep 2011 03:19:28 +0100
parents 1a5e2ee2e853
children e6cd09c7ef22
files sources/jaxws_src/src/com/sun/tools/internal/xjc/MessageBundle.properties sources/jaxws_src/src/com/sun/tools/internal/xjc/Options.java sources/jaxws_src/src/com/sun/xml/internal/bind/v2/schemagen/xmlschema/Element.java sources/jaxws_src/src/com/sun/xml/internal/bind/v2/schemagen/xmlschema/Schema.java sources/jaxws_src/src/com/sun/xml/internal/bind/v2/schemagen/xmlschema/SimpleType.java sources/jaxws_src/src/javax/xml/bind/DatatypeConverterImpl.java
diffstat 6 files changed, 51 insertions(+), 54 deletions(-) [+]
line wrap: on
line diff
--- a/sources/jaxws_src/src/com/sun/tools/internal/xjc/MessageBundle.properties	Wed Sep 28 02:14:18 2011 +0100
+++ b/sources/jaxws_src/src/com/sun/tools/internal/xjc/MessageBundle.properties	Wed Sep 28 03:19:28 2011 +0100
@@ -163,7 +163,7 @@
         xjc 2.2.4
 
 Driver.FullVersion = \
-        xjc full version "2.2.4-b129"
+        xjc full version "2.2.4-1b7"
 
 Driver.BuildID = 2.2.4
 
--- a/sources/jaxws_src/src/com/sun/tools/internal/xjc/Options.java	Wed Sep 28 02:14:18 2011 +0100
+++ b/sources/jaxws_src/src/com/sun/tools/internal/xjc/Options.java	Wed Sep 28 03:19:28 2011 +0100
@@ -45,7 +45,6 @@
 import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
-import java.util.logging.Level;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
@@ -61,9 +60,8 @@
 import com.sun.tools.internal.xjc.model.Model;
 import com.sun.tools.internal.xjc.reader.Util;
 import com.sun.xml.internal.bind.api.impl.NameConverter;
-import java.net.URI;
-import java.net.URISyntaxException;
 import java.util.Locale;
+import java.util.logging.Level;
 import java.util.logging.Logger;
 
 import org.xml.sax.EntityResolver;
@@ -380,11 +378,9 @@
 
     private InputSource fileToInputSource( File source ) {
         try {
-            String uri = new URI("file", source.getCanonicalPath(), null).toASCIIString();
-            return new InputSource(uri);
-        } catch (URISyntaxException ex) {
-            return new InputSource(source.getPath());
-        } catch (IOException ex) {
+            String url = source.toURL().toExternalForm();
+            return new InputSource(Util.escapeSpace(url));
+        } catch (MalformedURLException e) {
             return new InputSource(source.getPath());
         }
     }
@@ -417,13 +413,9 @@
     private InputSource absolutize(InputSource is) {
         // absolutize all the system IDs in the input, so that we can map system IDs to DOM trees.
         try {
-            String base = new File(".").getCanonicalFile().getAbsolutePath();
-            URI uri = URI.create(base).resolve(is.getSystemId());
-            if ("file".equals(uri.getScheme())) {
-               uri = new URI(uri.getScheme(), new File(uri).getCanonicalPath(), null);
-            }
-            is.setSystemId(uri.toURL().toExternalForm());
-        } catch( Exception e ) {
+            URL baseURL = new File(".").getCanonicalFile().toURL();
+            is.setSystemId( new URL(baseURL,is.getSystemId()).toExternalForm() );
+        } catch( IOException e ) {
             logger.log(Level.FINE, "{0}, {1}", new Object[]{is.getSystemId(), e.getLocalizedMessage()});
         }
         return is;
--- a/sources/jaxws_src/src/com/sun/xml/internal/bind/v2/schemagen/xmlschema/Element.java	Wed Sep 28 02:14:18 2011 +0100
+++ b/sources/jaxws_src/src/com/sun/xml/internal/bind/v2/schemagen/xmlschema/Element.java	Wed Sep 28 03:19:28 2011 +0100
@@ -38,10 +38,10 @@
     public Element type(QName value);
 
     @XmlAttribute
-    public Element block(String value);
+    public Element block(String[] value);
 
     @XmlAttribute
-    public Element block(String[] value);
+    public Element block(String value);
 
     @XmlAttribute
     public Element nillable(boolean value);
--- a/sources/jaxws_src/src/com/sun/xml/internal/bind/v2/schemagen/xmlschema/Schema.java	Wed Sep 28 02:14:18 2011 +0100
+++ b/sources/jaxws_src/src/com/sun/xml/internal/bind/v2/schemagen/xmlschema/Schema.java	Wed Sep 28 03:19:28 2011 +0100
@@ -57,10 +57,10 @@
     public Schema attributeFormDefault(String value);
 
     @XmlAttribute
-    public Schema blockDefault(String value);
+    public Schema blockDefault(String[] value);
 
     @XmlAttribute
-    public Schema blockDefault(String[] value);
+    public Schema blockDefault(String value);
 
     @XmlAttribute
     public Schema finalDefault(String value);
--- a/sources/jaxws_src/src/com/sun/xml/internal/bind/v2/schemagen/xmlschema/SimpleType.java	Wed Sep 28 02:14:18 2011 +0100
+++ b/sources/jaxws_src/src/com/sun/xml/internal/bind/v2/schemagen/xmlschema/SimpleType.java	Wed Sep 28 03:19:28 2011 +0100
@@ -36,10 +36,10 @@
 
 
     @XmlAttribute("final")
-    public SimpleType _final(String[] value);
+    public SimpleType _final(String value);
 
     @XmlAttribute("final")
-    public SimpleType _final(String value);
+    public SimpleType _final(String[] value);
 
     @XmlAttribute
     public SimpleType name(String value);
--- a/sources/jaxws_src/src/javax/xml/bind/DatatypeConverterImpl.java	Wed Sep 28 02:14:18 2011 +0100
+++ b/sources/jaxws_src/src/javax/xml/bind/DatatypeConverterImpl.java	Wed Sep 28 03:19:28 2011 +0100
@@ -779,8 +779,10 @@
      *      in the output buffer where the further bytes should be placed.
      */
     public static int _printBase64Binary(byte[] input, int offset, int len, char[] buf, int ptr) {
-        int i = offset;
-        for (; i <= (len - 3); i += 3) {
+        // encode elements until only 1 or 2 elements are left to encode
+        int remaining = len;
+        int i;
+        for (i = offset;remaining >= 3; remaining -= 3, i += 3) {
             buf[ptr++] = encode(input[i] >> 2);
             buf[ptr++] = encode(
                     ((input[i] & 0x3) << 4)
@@ -790,21 +792,21 @@
                     | ((input[i + 2] >> 6) & 0x3));
             buf[ptr++] = encode(input[i + 2] & 0x3F);
         }
-        if (len - i == 2) {
-            //(i == len - 2) {
-            buf[ptr++] = encode(input[i] >> 2);
-            buf[ptr++] = encode(
-                    ((input[i] & 0x3) << 4)
-                    | ((input[i + 1] >> 4) & 0xF));
-            buf[ptr++] = encode((input[i + 1] & 0xF) << 2);
-            buf[ptr++] = '=';
-        } else if (len - i == 1) {
-            //if (i == len - 1) {
+        // encode when exactly 1 element (left) to encode
+        if (remaining == 1) {
             buf[ptr++] = encode(input[i] >> 2);
             buf[ptr++] = encode(((input[i]) & 0x3) << 4);
             buf[ptr++] = '=';
             buf[ptr++] = '=';
         }
+        // encode when exactly 2 elements (left) to encode
+        if (remaining == 2) {
+            buf[ptr++] = encode(input[i] >> 2);
+            buf[ptr++] = encode(((input[i] & 0x3) << 4)
+                    | ((input[i + 1] >> 4) & 0xF));
+            buf[ptr++] = encode((input[i + 1] & 0xF) << 2);
+            buf[ptr++] = '=';
+        }
         return ptr;
     }
 
@@ -820,32 +822,35 @@
      */
     public static int _printBase64Binary(byte[] input, int offset, int len, byte[] out, int ptr) {
         byte[] buf = out;
-        int i = offset;
-        for (; i <= (len - 3); i += 3) {
-            buf[ptr++] = encodeByte(input[i] >> 2);
+        int remaining = len;
+        int i;
+        for (i=offset; remaining >= 3; remaining -= 3, i += 3 ) {
+            buf[ptr++] = encodeByte(input[i]>>2);
             buf[ptr++] = encodeByte(
-                    ((input[i] & 0x3) << 4)
-                    | ((input[i + 1] >> 4) & 0xF));
+                        ((input[i]&0x3)<<4) |
+                        ((input[i+1]>>4)&0xF));
             buf[ptr++] = encodeByte(
-                    ((input[i + 1] & 0xF) << 2)
-                    | ((input[i + 2] >> 6) & 0x3));
-            buf[ptr++] = encodeByte(input[i + 2] & 0x3F);
+                        ((input[i+1]&0xF)<<2)|
+                        ((input[i+2]>>6)&0x3));
+            buf[ptr++] = encodeByte(input[i+2]&0x3F);
         }
-        // encode when exactly 2 elements (left) to encode
-        if (len - i == 2) {
-            buf[ptr++] = encodeByte(input[i] >> 2);
-            buf[ptr++] = encodeByte(
-                    ((input[i] & 0x3) << 4)
-                    | ((input[i + 1] >> 4) & 0xF));
-            buf[ptr++] = encodeByte((input[i + 1] & 0xF) << 2);
-            buf[ptr++] = '=';
-        } else if (len - i == 1) {
-            // encode when exactly 1 element (left) to encode
-            buf[ptr++] = encodeByte(input[i] >> 2);
-            buf[ptr++] = encodeByte(((input[i]) & 0x3) << 4);
+        // encode when exactly 1 element (left) to encode
+        if (remaining == 1) {
+            buf[ptr++] = encodeByte(input[i]>>2);
+            buf[ptr++] = encodeByte(((input[i])&0x3)<<4);
             buf[ptr++] = '=';
             buf[ptr++] = '=';
         }
+        // encode when exactly 2 elements (left) to encode
+        if (remaining == 2) {
+            buf[ptr++] = encodeByte(input[i]>>2);
+            buf[ptr++] = encodeByte(
+                        ((input[i]&0x3)<<4) |
+                        ((input[i+1]>>4)&0xF));
+            buf[ptr++] = encodeByte((input[i+1]&0xF)<<2);
+            buf[ptr++] = '=';
+        }
+
         return ptr;
     }