commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ggreg...@apache.org
Subject svn commit: r1489693 - /commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/LocaleUtils.java
Date Wed, 05 Jun 2013 03:37:51 GMT
Author: ggregory
Date: Wed Jun  5 03:37:50 2013
New Revision: 1489693

URL: http://svn.apache.org/r1489693
Log:
Statement unnecessarily nested within else clause.

Modified:
    commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/LocaleUtils.java

Modified: commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/LocaleUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/LocaleUtils.java?rev=1489693&r1=1489692&r2=1489693&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/LocaleUtils.java (original)
+++ commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/LocaleUtils.java Wed
Jun  5 03:37:50 2013
@@ -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));
     }
 
     //-----------------------------------------------------------------------



Mime
View raw message