changeset 956:412597b17df8 jdk8u60-b12

Merge
author lana
date Thu, 16 Apr 2015 16:00:35 -0700
parents 579138ef25da 4a3b002f98a5
children c61fbe5729d4
files
diffstat 5 files changed, 23 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/src/com/sun/org/apache/xalan/internal/xsltc/runtime/BasisLibrary.java	Wed Apr 15 14:45:16 2015 -0700
+++ b/src/com/sun/org/apache/xalan/internal/xsltc/runtime/BasisLibrary.java	Thu Apr 16 16:00:35 2015 -0700
@@ -270,7 +270,7 @@
         if (Double.isNaN(start))
             return(EMPTYSTRING);
 
-        final int strlen = value.length();
+        final int strlen = getStringLength(value);
         int istart = (int)Math.round(start) - 1;
 
         if (istart > strlen)
@@ -278,6 +278,7 @@
         if (istart < 1)
             istart = 0;
         try {
+            istart = value.offsetByCodePoints(0, istart);
             return value.substring(istart);
         } catch (IndexOutOfBoundsException e) {
             runTimeError(RUN_TIME_INTERNAL_ERR, "substring()");
@@ -297,24 +298,30 @@
             return(EMPTYSTRING);
 
         int istart = (int)Math.round(start) - 1;
+        int ilength = (int)Math.round(length);
         final int isum;
         if (Double.isInfinite(length))
             isum = Integer.MAX_VALUE;
         else
-            isum = istart + (int)Math.round(length);
+            isum = istart + ilength;
 
-        final int strlen = value.length();
+        final int strlen = getStringLength(value);
         if (isum < 0 || istart > strlen)
                 return(EMPTYSTRING);
 
-        if (istart < 0)
+        if (istart < 0) {
+            ilength += istart;
             istart = 0;
+        }
 
         try {
-            if (isum > strlen)
+            istart = value.offsetByCodePoints(0, istart);
+            if (isum > strlen) {
                 return value.substring(istart);
-            else
-                return value.substring(istart, isum);
+            } else {
+                int offset = value.offsetByCodePoints(istart, ilength);
+                return value.substring(istart, offset);
+            }
         } catch (IndexOutOfBoundsException e) {
             runTimeError(RUN_TIME_INTERNAL_ERR, "substring()");
             return null;
--- a/src/com/sun/org/apache/xerces/internal/impl/XMLDTDScannerImpl.java	Wed Apr 15 14:45:16 2015 -0700
+++ b/src/com/sun/org/apache/xerces/internal/impl/XMLDTDScannerImpl.java	Thu Apr 16 16:00:35 2015 -0700
@@ -1418,7 +1418,7 @@
             // AttValue
             boolean isVC = !fStandalone  &&  (fSeenExternalDTD || fSeenExternalPE) ;
             scanAttributeValue(defaultVal, nonNormalizedDefaultVal, atName,
-            fAttributes, 0, isVC);
+            fAttributes, 0, isVC, elName);
         }
         return defaultType;
 
--- a/src/com/sun/org/apache/xerces/internal/impl/XMLDocumentFragmentScannerImpl.java	Wed Apr 15 14:45:16 2015 -0700
+++ b/src/com/sun/org/apache/xerces/internal/impl/XMLDocumentFragmentScannerImpl.java	Thu Apr 16 16:00:35 2015 -0700
@@ -1546,7 +1546,7 @@
 
         scanAttributeValue(tmpStr, fTempString2,
                 fAttributeQName.rawname, attributes,
-                attIndex, isVC);
+                attIndex, isVC, fCurrentElement.rawname);
 
         // content
         int oldLen = attributes.getLength();
--- a/src/com/sun/org/apache/xerces/internal/impl/XMLNSDocumentScannerImpl.java	Wed Apr 15 14:45:16 2015 -0700
+++ b/src/com/sun/org/apache/xerces/internal/impl/XMLNSDocumentScannerImpl.java	Thu Apr 16 16:00:35 2015 -0700
@@ -438,7 +438,7 @@
         XMLString tmpStr = getString();
         scanAttributeValue(tmpStr, fTempString2,
                 fAttributeQName.rawname, attributes,
-                attrIndex, isVC);
+                attrIndex, isVC, fCurrentElement.rawname);
 
         String value = null;
         //fTempString.toString();
--- a/src/com/sun/org/apache/xerces/internal/impl/XMLScanner.java	Wed Apr 15 14:45:16 2015 -0700
+++ b/src/com/sun/org/apache/xerces/internal/impl/XMLScanner.java	Thu Apr 16 16:00:35 2015 -0700
@@ -812,6 +812,7 @@
      * @param attrIndex The index of the attribute to use from the list.
      * @param checkEntities true if undeclared entities should be reported as VC violation,
      *                      false if undeclared entities should be reported as WFC violation.
+     * @param eleName The name of element to which this attribute belongs.
      *
      * <strong>Note:</strong> This method uses fStringBuffer2, anything in it
      * at the time of calling is lost.
@@ -820,13 +821,13 @@
             XMLString nonNormalizedValue,
             String atName,
             XMLAttributes attributes, int attrIndex,
-            boolean checkEntities)
+            boolean checkEntities, String eleName)
             throws IOException, XNIException {
         XMLStringBuffer stringBuffer = null;
         // quote
         int quote = fEntityScanner.peekChar();
         if (quote != '\'' && quote != '"') {
-            reportFatalError("OpenQuoteExpected", new Object[]{atName});
+            reportFatalError("OpenQuoteExpected", new Object[]{eleName, atName});
         }
 
         fEntityScanner.scanChar();
@@ -952,7 +953,7 @@
                     }
                 } else if (c == '<') {
                     reportFatalError("LessthanInAttValue",
-                            new Object[] { null, atName });
+                            new Object[] { eleName, atName });
                             fEntityScanner.scanChar();
                             if (entityDepth == fEntityDepth && fNeedNonNormalizedValue) {
                                 fStringBuffer2.append((char)c);
@@ -987,7 +988,7 @@
                     }
                 } else if (c != -1 && isInvalidLiteral(c)) {
                     reportFatalError("InvalidCharInAttValue",
-                            new Object[] {Integer.toString(c, 16)});
+                            new Object[] {eleName, atName, Integer.toString(c, 16)});
                             fEntityScanner.scanChar();
                             if (entityDepth == fEntityDepth && fNeedNonNormalizedValue) {
                                 fStringBuffer2.append((char)c);
@@ -1016,7 +1017,7 @@
         // quote
         int cquote = fEntityScanner.scanChar();
         if (cquote != quote) {
-            reportFatalError("CloseQuoteExpected", new Object[]{atName});
+            reportFatalError("CloseQuoteExpected", new Object[]{eleName, atName});
         }
     } // scanAttributeValue()