Statement unnecessarily nested within else clause.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@1489693 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
c6ad3493e8
commit
d77fe491fd
|
@ -116,39 +116,38 @@ public class LocaleUtils {
|
|||
throw new IllegalArgumentException("Invalid locale format: " + str);
|
||||
}
|
||||
return new Locale("", str.substring(1, 3), str.substring(4));
|
||||
} else {
|
||||
final char ch1 = str.charAt(1);
|
||||
if (!Character.isLowerCase(ch0) || !Character.isLowerCase(ch1)) {
|
||||
throw new IllegalArgumentException("Invalid locale format: " + str);
|
||||
}
|
||||
if (len == 2) {
|
||||
return new Locale(str);
|
||||
}
|
||||
if (len < 5) {
|
||||
throw new IllegalArgumentException("Invalid locale format: " + str);
|
||||
}
|
||||
if (str.charAt(2) != '_') {
|
||||
throw new IllegalArgumentException("Invalid locale format: " + str);
|
||||
}
|
||||
final char ch3 = str.charAt(3);
|
||||
if (ch3 == '_') {
|
||||
return new Locale(str.substring(0, 2), "", str.substring(4));
|
||||
}
|
||||
final char ch4 = str.charAt(4);
|
||||
if (!Character.isUpperCase(ch3) || !Character.isUpperCase(ch4)) {
|
||||
throw new IllegalArgumentException("Invalid locale format: " + str);
|
||||
}
|
||||
if (len == 5) {
|
||||
return new Locale(str.substring(0, 2), str.substring(3, 5));
|
||||
}
|
||||
if (len < 7) {
|
||||
throw new IllegalArgumentException("Invalid locale format: " + str);
|
||||
}
|
||||
if (str.charAt(5) != '_') {
|
||||
throw new IllegalArgumentException("Invalid locale format: " + str);
|
||||
}
|
||||
return new Locale(str.substring(0, 2), str.substring(3, 5), str.substring(6));
|
||||
}
|
||||
final char ch1 = str.charAt(1);
|
||||
if (!Character.isLowerCase(ch0) || !Character.isLowerCase(ch1)) {
|
||||
throw new IllegalArgumentException("Invalid locale format: " + str);
|
||||
}
|
||||
if (len == 2) {
|
||||
return new Locale(str);
|
||||
}
|
||||
if (len < 5) {
|
||||
throw new IllegalArgumentException("Invalid locale format: " + str);
|
||||
}
|
||||
if (str.charAt(2) != '_') {
|
||||
throw new IllegalArgumentException("Invalid locale format: " + str);
|
||||
}
|
||||
final char ch3 = str.charAt(3);
|
||||
if (ch3 == '_') {
|
||||
return new Locale(str.substring(0, 2), "", str.substring(4));
|
||||
}
|
||||
final char ch4 = str.charAt(4);
|
||||
if (!Character.isUpperCase(ch3) || !Character.isUpperCase(ch4)) {
|
||||
throw new IllegalArgumentException("Invalid locale format: " + str);
|
||||
}
|
||||
if (len == 5) {
|
||||
return new Locale(str.substring(0, 2), str.substring(3, 5));
|
||||
}
|
||||
if (len < 7) {
|
||||
throw new IllegalArgumentException("Invalid locale format: " + str);
|
||||
}
|
||||
if (str.charAt(5) != '_') {
|
||||
throw new IllegalArgumentException("Invalid locale format: " + str);
|
||||
}
|
||||
return new Locale(str.substring(0, 2), str.substring(3, 5), str.substring(6));
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
|
|
Loading…
Reference in New Issue