mirror of
https://github.com/corda/corda.git
synced 2025-01-22 12:28:11 +00:00
fix thinko in String.regionMatches; ignore case when checking charsetName in String ctor
This commit is contained in:
parent
a201d28e5c
commit
4fca1d64ba
@ -52,7 +52,7 @@ public final class String
|
|||||||
throws UnsupportedEncodingException
|
throws UnsupportedEncodingException
|
||||||
{
|
{
|
||||||
this(bytes, offset, length);
|
this(bytes, offset, length);
|
||||||
if (!charsetName.equals("UTF-8")) {
|
if (! charsetName.equalsIgnoreCase("UTF-8")) {
|
||||||
throw new UnsupportedEncodingException(charsetName);
|
throw new UnsupportedEncodingException(charsetName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -416,7 +416,7 @@ public final class String
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
throw new IndexOutOfBoundsException
|
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,
|
public boolean regionMatches(boolean ignoreCase, int thisOffset,
|
||||||
String match, int matchOffset, int length)
|
String match, int matchOffset, int length)
|
||||||
{
|
{
|
||||||
String a = substring(thisOffset, length);
|
String a = substring(thisOffset, thisOffset + length);
|
||||||
String b = match.substring(matchOffset, length);
|
String b = match.substring(matchOffset, matchOffset + length);
|
||||||
if (ignoreCase) {
|
if (ignoreCase) {
|
||||||
return a.equalsIgnoreCase(b);
|
return a.equalsIgnoreCase(b);
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user