]> source.dussan.org Git - poi.git/commitdiff
Adjust for JDK 8 where an empty locale is added to the array returned by DateFormat...
authorDominik Stadler <centic@apache.org>
Sat, 8 Mar 2014 16:46:59 +0000 (16:46 +0000)
committerDominik Stadler <centic@apache.org>
Sat, 8 Mar 2014 16:46:59 +0000 (16:46 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1575563 13f79535-47bb-0310-9956-ffa450edef68

src/java/org/apache/poi/ss/util/DateFormatConverter.java
src/testcases/org/apache/poi/ss/util/TestDateFormatConverter.java

index 316d1ed7b64fd2e41b1832cfb8348f75cf2879a8..bca998e806d263592a59ff5c55e988f8cc4b068c 100644 (file)
@@ -93,6 +93,7 @@ public class DateFormatConverter  {
                        return result.toArray(new String[0]);\r
                }\r
                \r
+               @Override\r
                public String toString() {\r
                        StringBuilder result = new StringBuilder();\r
                        \r
@@ -323,6 +324,9 @@ public class DateFormatConverter  {
                result.put( "in", "[$-0421]" );\r
                result.put( "iw", "[$-40D]" );\r
                \r
+               // JDK 8 adds an empty locale-string, see also https://issues.apache.org/jira/browse/LANG-941\r
+               result.put( "", "[$-0409]" );\r
+               \r
                return result;\r
        }\r
        \r
index e4b7c389275aef4e86f6df3ce8dd7a0104ebf788..95042e50f33fbf13dee780a7d1f1205aee64c955 100644 (file)
@@ -137,5 +137,11 @@ public final class TestDateFormatConverter extends TestCase {
         outputLocaleDataFormats(date, false, true, DateFormat.LONG, "Long" );
         outputLocaleDataFormats(date, false, true, DateFormat.FULL, "Full" );
     }
+    
+    public void testJDK8EmptyLocale() {
+        // JDK 8 seems to add an empty locale-string to the list returned via DateFormat.getAvailableLocales()
+        // therefore we now cater for this special locale as well
+        DateFormatConverter.getPrefixForLocale(new Locale(""));
+    }
 
 }