From 4fca1d64ba55ec23c308560eaf99a6cf5510f5b7 Mon Sep 17 00:00:00 2001 From: Joel Dice Date: Sat, 6 Jun 2009 20:30:58 -0600 Subject: [PATCH] fix thinko in String.regionMatches; ignore case when checking charsetName in String ctor --- classpath/java/lang/String.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/classpath/java/lang/String.java b/classpath/java/lang/String.java index 10485c25cd..1c11712da3 100644 --- a/classpath/java/lang/String.java +++ b/classpath/java/lang/String.java @@ -52,7 +52,7 @@ public final class String throws UnsupportedEncodingException { this(bytes, offset, length); - if (!charsetName.equals("UTF-8")) { + if (! charsetName.equalsIgnoreCase("UTF-8")) { throw new UnsupportedEncodingException(charsetName); } } @@ -416,7 +416,7 @@ public final class String } } else { throw new IndexOutOfBoundsException - (start + " not in (0, " + end + ") or " + end + " > " + length); + (start + " not in [0, " + end + ") or " + end + " > " + length); } } @@ -640,8 +640,8 @@ public final class String public boolean regionMatches(boolean ignoreCase, int thisOffset, String match, int matchOffset, int length) { - String a = substring(thisOffset, length); - String b = match.substring(matchOffset, length); + String a = substring(thisOffset, thisOffset + length); + String b = match.substring(matchOffset, matchOffset + length); if (ignoreCase) { return a.equalsIgnoreCase(b); } else {