You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by st...@apache.org on 2011/10/20 21:38:40 UTC

svn commit: r1187008 - /myfaces/commons/branches/jsf_20/myfaces-commons-converters/src/main/java/org/apache/myfaces/commons/converter/AbstractTypedNumberConverter.java

Author: struberg
Date: Thu Oct 20 19:38:40 2011
New Revision: 1187008

URL: http://svn.apache.org/viewvc?rev=1187008&view=rev
Log:
MFCOMMONS-40 replace ugly switch with fallthrough with a simple if construct

Modified:
    myfaces/commons/branches/jsf_20/myfaces-commons-converters/src/main/java/org/apache/myfaces/commons/converter/AbstractTypedNumberConverter.java

Modified: myfaces/commons/branches/jsf_20/myfaces-commons-converters/src/main/java/org/apache/myfaces/commons/converter/AbstractTypedNumberConverter.java
URL: http://svn.apache.org/viewvc/myfaces/commons/branches/jsf_20/myfaces-commons-converters/src/main/java/org/apache/myfaces/commons/converter/AbstractTypedNumberConverter.java?rev=1187008&r1=1187007&r2=1187008&view=diff
==============================================================================
--- myfaces/commons/branches/jsf_20/myfaces-commons-converters/src/main/java/org/apache/myfaces/commons/converter/AbstractTypedNumberConverter.java (original)
+++ myfaces/commons/branches/jsf_20/myfaces-commons-converters/src/main/java/org/apache/myfaces/commons/converter/AbstractTypedNumberConverter.java Thu Oct 20 19:38:40 2011
@@ -539,28 +539,28 @@ public abstract class AbstractTypedNumbe
                 byte value = Byte.parseByte(version.substring(0, 1));
                 version = version.substring(idx + 1, version.length());
                 idx = version.indexOf('.');
-                switch (i)
+                if (i == 0)
                 {
-                    case 0:
-                        if (value == 1)
-                        {
-                            java14 = 1;
-                            break;
-                        }
-                        else if (value > 1)
-                        {
-                            java14 = 2;
-                        }
-                    case 1:
-                        if (java14 > 0 && value >= 4)
-                        {
-                            java14 = 2;
-                        }
-                    default:
-                        idx = 0;
-                        version = null;
+                    if (value == 1)
+                    {
+                        java14 = 1;
                         break;
+                    }
+                    else if (value > 1)
+                    {
+                        java14 = 2;
+                    }
                 }
+                if (i <=1)
+                {
+                    if (java14 > 0 && value >= 4)
+                    {
+                        java14 = 2;
+                    }
+                }
+
+                idx = 0;
+                version = null;
             }
             else
             {