mirror of
https://github.com/apache/commons-lang.git
synced 2025-02-08 11:05:09 +00:00
Statement unnecessarily nested within else clause.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@1586291 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
39168bb734
commit
70d9e8b23d
@ -186,31 +186,30 @@ static boolean regionMatches(final CharSequence cs, final boolean ignoreCase, fi
|
|||||||
final CharSequence substring, final int start, final int length) {
|
final CharSequence substring, final int start, final int length) {
|
||||||
if (cs instanceof String && substring instanceof String) {
|
if (cs instanceof String && substring instanceof String) {
|
||||||
return ((String) cs).regionMatches(ignoreCase, thisStart, (String) substring, start, length);
|
return ((String) cs).regionMatches(ignoreCase, thisStart, (String) substring, start, length);
|
||||||
} else {
|
}
|
||||||
int index1 = thisStart;
|
int index1 = thisStart;
|
||||||
int index2 = start;
|
int index2 = start;
|
||||||
int tmpLen = length;
|
int tmpLen = length;
|
||||||
|
|
||||||
while (tmpLen-- > 0) {
|
while (tmpLen-- > 0) {
|
||||||
char c1 = cs.charAt(index1++);
|
char c1 = cs.charAt(index1++);
|
||||||
char c2 = substring.charAt(index2++);
|
char c2 = substring.charAt(index2++);
|
||||||
|
|
||||||
if (c1 == c2) {
|
if (c1 == c2) {
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
|
|
||||||
if (!ignoreCase) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// The same check as in String.regionMatches():
|
|
||||||
if (Character.toUpperCase(c1) != Character.toUpperCase(c2)
|
|
||||||
&& Character.toLowerCase(c1) != Character.toLowerCase(c2)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
if (!ignoreCase) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// The same check as in String.regionMatches():
|
||||||
|
if (Character.toUpperCase(c1) != Character.toUpperCase(c2)
|
||||||
|
&& Character.toLowerCase(c1) != Character.toLowerCase(c2)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user