8076290: JCK test api/xsl/conf/string/string17 starts failing after JDK-8074297
authoraefimov
Wed, 01 Apr 2015 16:01:10 +0300
changeset 29764 63210c2facec
parent 29763 e69895779fa3
child 29765 d0707eacc322
8076290: JCK test api/xsl/conf/string/string17 starts failing after JDK-8074297 Reviewed-by: joehw
jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/runtime/BasisLibrary.java
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/runtime/BasisLibrary.java	Mon Mar 30 14:54:57 2015 +0300
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/runtime/BasisLibrary.java	Wed Apr 01 16:01:10 2015 +0300
@@ -298,7 +298,7 @@
             return(EMPTYSTRING);
 
         int istart = (int)Math.round(start) - 1;
-        final int ilength = (int)Math.round(length);
+        int ilength = (int)Math.round(length);
         final int isum;
         if (Double.isInfinite(length))
             isum = Integer.MAX_VALUE;
@@ -309,8 +309,10 @@
         if (isum < 0 || istart > strlen)
                 return(EMPTYSTRING);
 
-        if (istart < 0)
+        if (istart < 0) {
+            ilength += istart;
             istart = 0;
+        }
 
         try {
             istart = value.offsetByCodePoints(0, istart);