commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1390811 - /commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/time/FastDateParser.java
Date Thu, 27 Sep 2012 02:18:18 GMT
Author: sebb
Date: Thu Sep 27 02:18:18 2012
New Revision: 1390811

URL: http://svn.apache.org/viewvc?rev=1390811&view=rev
Log:
Don't save short eras if they are the same as the long eras

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

Modified: commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/time/FastDateParser.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/time/FastDateParser.java?rev=1390811&r1=1390810&r2=1390811&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/time/FastDateParser.java
(original)
+++ commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/time/FastDateParser.java
Thu Sep 27 02:18:18 2012
@@ -381,9 +381,14 @@ public class FastDateParser implements D
                 // see: https://issues.apache.org/jira/browse/TRINIDAD-2126
                 Calendar c = Calendar.getInstance(locale);
                 // N.B. Some calendars have different short and long symbols, e.g. ja_JP_JP
+                // TODO Seems to be only that locale; if that is guaranteed, could skip some
work here
                 String[] shortEras = toArray(c.getDisplayNames(Calendar.ERA, Calendar.SHORT,
locale));
                 String[] longEras = toArray(c.getDisplayNames(Calendar.ERA, Calendar.LONG,
locale));
-                fieldKeyValues= createKeyValues(longEras, shortEras);
+                if (Arrays.equals(shortEras, longEras)) {
+                    fieldKeyValues = createKeyValues(longEras, null); // save memory
+                } else {
+                    fieldKeyValues = createKeyValues(longEras, shortEras);              
     
+                }
                 break;
             case Calendar.DAY_OF_WEEK:
                 fieldKeyValues= createKeyValues(symbols.getWeekdays(), symbols.getShortWeekdays());



Mime
View raw message