logging-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ggreg...@apache.org
Subject svn commit: r1490164 - /logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/pattern/CachedDateFormat.java
Date Thu, 06 Jun 2013 06:02:06 GMT
Author: ggregory
Date: Thu Jun  6 06:02:06 2013
New Revision: 1490164

URL: http://svn.apache.org/r1490164
Log:
Statements unnecessarily nested within else clause.

Modified:
    logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/pattern/CachedDateFormat.java

Modified: logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/pattern/CachedDateFormat.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/pattern/CachedDateFormat.java?rev=1490164&r1=1490163&r2=1490164&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/pattern/CachedDateFormat.java
(original)
+++ logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/pattern/CachedDateFormat.java
Thu Jun  6 06:02:06 2013
@@ -194,32 +194,30 @@ final class CachedDateFormat extends Dat
          */
         if (plusMagic.length() != formatted.length()) {
             return UNRECOGNIZED_MILLISECONDS;
-        } else {
-            // find first difference between values
-            for (int i = 0; i < formatted.length(); i++) {
-                if (formatted.charAt(i) != plusMagic.charAt(i)) {
-                    //
-                    //   determine the expected digits for the base time
-                    final StringBuffer formattedMillis = new StringBuffer("ABC");
-                    millisecondFormat(millis, formattedMillis, 0);
-
-                    final String plusZero = formatter.format(new Date(slotBegin));
-
-                    //   If the next 3 characters match the magic
-                    //      string and the expected string
-                    if (
-                        (plusZero.length() == formatted.length())
-                            && magicString.regionMatches(
-                            0, plusMagic, i, magicString.length())
-                            && formattedMillis.toString().regionMatches(
-                            0, formatted, i, magicString.length())
-                            && ZERO_STRING.regionMatches(
-                            0, plusZero, i, ZERO_STRING.length())) {
-                        return i;
-                    } else {
-                        return UNRECOGNIZED_MILLISECONDS;
-                    }
+        }
+        // find first difference between values
+        for (int i = 0; i < formatted.length(); i++) {
+            if (formatted.charAt(i) != plusMagic.charAt(i)) {
+                //
+                //   determine the expected digits for the base time
+                final StringBuffer formattedMillis = new StringBuffer("ABC");
+                millisecondFormat(millis, formattedMillis, 0);
+
+                final String plusZero = formatter.format(new Date(slotBegin));
+
+                //   If the next 3 characters match the magic
+                //      string and the expected string
+                if (
+                    (plusZero.length() == formatted.length())
+                        && magicString.regionMatches(
+                        0, plusMagic, i, magicString.length())
+                        && formattedMillis.toString().regionMatches(
+                        0, formatted, i, magicString.length())
+                        && ZERO_STRING.regionMatches(
+                        0, plusZero, i, ZERO_STRING.length())) {
+                    return i;
                 }
+                return UNRECOGNIZED_MILLISECONDS;
             }
         }
 



Mime
View raw message