This fixes a bug introduced by Ian's recent optimisation
in java.lang.String.  x has a different meaning in toLowerCase
to in toUpperCase, and the current use of count - x - offset
results in characters being dropped from the output string.

ChangeLog:

2008-05-06  Andrew John Hughes  <[EMAIL PROTECTED]>

        PR classpath/35482
        * java/lang/String.java:
        (toLowerCase()): Fix calculation of number
        of characters to copy.
        (toLowerCaseTurkish()): Likewise.

-- 
Andrew :)

Support Free Java!
Contribute to GNU Classpath and the OpenJDK
http://www.gnu.org/software/classpath
http://openjdk.java.net
PGP Key: 94EFD9D8 (http://subkeys.pgp.net)
Fingerprint = F8EF F1EA 401E 2E60 15FA  7927 142C 2591 94EF D9D8
Index: java/lang/String.java
===================================================================
RCS file: /sources/classpath/classpath/java/lang/String.java,v
retrieving revision 1.89
diff -u -r1.89 String.java
--- java/lang/String.java       16 Mar 2008 22:04:50 -0000      1.89
+++ java/lang/String.java       6 May 2008 02:17:58 -0000
@@ -1452,7 +1452,7 @@
     // Now we perform the conversion. Fortunately, there are no multi-character
     // lowercase expansions in Unicode 3.0.0.
     char[] newStr = new char[count];
-    VMSystem.arraycopy(value, offset, newStr, 0, count - (x - offset));
+    VMSystem.arraycopy(value, offset, newStr, 0, x - offset);
     do
       {
         char ch = value[x];
@@ -1508,7 +1508,7 @@
         // Now we perform the conversion. Fortunately, there are no
         // multi-character lowercase expansions in Unicode 3.0.0.
         char[] newStr = new char[count];
-        VMSystem.arraycopy(value, offset, newStr, 0, count - (x - offset));
+        VMSystem.arraycopy(value, offset, newStr, 0, x - offset);
         do
           {
             char ch = value[x];

Reply via email to