7166896: DocumentBuilder.parse(String uri) is not IPv6 enabled. It throws MalformedURLException
authorjoehw
Tue, 26 Jun 2012 15:28:21 -0700
changeset 13176 2c1fa96ba3d7
parent 13063 c1602d72983b
child 13177 a2cf86579ad4
7166896: DocumentBuilder.parse(String uri) is not IPv6 enabled. It throws MalformedURLException Summary: skip the added international character handling for general paths Reviewed-by: lancea
jaxp/src/com/sun/org/apache/xerces/internal/impl/XMLEntityManager.java
--- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/XMLEntityManager.java	Sun Jun 17 21:29:12 2012 -0700
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/XMLEntityManager.java	Tue Jun 26 15:28:21 2012 -0700
@@ -2609,6 +2609,18 @@
         if (str == null) {
             return str;
         }
+        int len = str.length(), i=0, ch;
+        for (; i < len; i++) {
+            ch = str.charAt(i);
+            // if it's not an ASCII 7 character, break here, and use UTF-8 encoding
+            if (ch >= 128)
+                break;
+        }
+
+        // we saw no non-ascii-7 character
+        if (i == len) {
+            return str;
+        }
 
         // get UTF-8 bytes for the string
         StringBuffer buffer = new StringBuffer();
@@ -2620,11 +2632,11 @@
             // should never happen
             return str;
         }
-        int len = bytes.length;
-        int ch;
+
+        len = bytes.length;
 
         // for each byte
-        for (int i = 0; i < len; i++) {
+        for (i = 0; i < len; i++) {
             b = bytes[i];
             // for non-ascii character: make it positive, then escape
             if (b < 0) {