changeset 13176:2c1fa96ba3d7

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
author joehw
date Tue, 26 Jun 2012 15:28:21 -0700
parents c1602d72983b
children a2cf86579ad4
files jaxp/src/com/sun/org/apache/xerces/internal/impl/XMLEntityManager.java
diffstat 1 files changed, 15 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- 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) {