commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ggreg...@apache.org
Subject svn commit: r1478487 - /commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/time/DurationFormatUtils.java
Date Thu, 02 May 2013 19:04:35 GMT
Author: ggregory
Date: Thu May  2 19:04:35 2013
New Revision: 1478487

URL: http://svn.apache.org/r1478487
Log:
Fix some formatting.

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

Modified: commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/time/DurationFormatUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/time/DurationFormatUtils.java?rev=1478487&r1=1478486&r2=1478487&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/time/DurationFormatUtils.java
(original)
+++ commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/time/DurationFormatUtils.java
Thu May  2 19:04:35 2013
@@ -490,52 +490,66 @@ public class DurationFormatUtils {
         StringBuilder buffer = null;
         Token previous = null;
         final int sz = array.length;
-        for(int i=0; i<sz; i++) {
+        for (int i = 0; i < sz; i++) {
             final char ch = array[i];
-            if(inLiteral && ch != '\'') {
+            if (inLiteral && ch != '\'') {
                 buffer.append(ch); // buffer can't be null if inLiteral is true
                 continue;
             }
             Object value = null;
-            switch(ch) {
-                // TODO: Need to handle escaping of '
-                case '\'' : 
-                  if(inLiteral) {
-                      buffer = null;
-                      inLiteral = false;
-                  } else {
-                      buffer = new StringBuilder();
-                      list.add(new Token(buffer));
-                      inLiteral = true;
-                  }
-                  break;
-                case 'y'  : value = y; break;
-                case 'M'  : value = M; break;
-                case 'd'  : value = d; break;
-                case 'H'  : value = H; break;
-                case 'm'  : value = m; break;
-                case 's'  : value = s; break;
-                case 'S'  : value = S; break;
-                default   : 
-                  if(buffer == null) {
-                      buffer = new StringBuilder();
-                      list.add(new Token(buffer));
-                  }
-                  buffer.append(ch);
+            switch (ch) {
+            // TODO: Need to handle escaping of '
+            case '\'':
+                if (inLiteral) {
+                    buffer = null;
+                    inLiteral = false;
+                } else {
+                    buffer = new StringBuilder();
+                    list.add(new Token(buffer));
+                    inLiteral = true;
+                }
+                break;
+            case 'y':
+                value = y;
+                break;
+            case 'M':
+                value = M;
+                break;
+            case 'd':
+                value = d;
+                break;
+            case 'H':
+                value = H;
+                break;
+            case 'm':
+                value = m;
+                break;
+            case 's':
+                value = s;
+                break;
+            case 'S':
+                value = S;
+                break;
+            default:
+                if (buffer == null) {
+                    buffer = new StringBuilder();
+                    list.add(new Token(buffer));
+                }
+                buffer.append(ch);
             }
 
-            if(value != null) {
-                if(previous != null && previous.getValue() == value) {
+            if (value != null) {
+                if (previous != null && previous.getValue() == value) {
                     previous.increment();
                 } else {
                     final Token token = new Token(value);
-                    list.add(token); 
+                    list.add(token);
                     previous = token;
                 }
-                buffer = null; 
+                buffer = null;
             }
         }
-        return list.toArray( new Token[list.size()] );
+        return list.toArray(new Token[list.size()]);
     }
 
     //-----------------------------------------------------------------------



Mime
View raw message