changeset 362:7920ead2cc75

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 a079926a6d81
children 219e720a1baa
files src/com/sun/org/apache/xerces/internal/impl/XMLEntityManager.java
diffstat 1 files changed, 15 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/com/sun/org/apache/xerces/internal/impl/XMLEntityManager.java	Sun Jun 17 21:29:12 2012 -0700
+++ b/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) {