Adjust for JDK 8 where an empty locale is added to the array returned by DateFormat.getAvailableLocales()

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1575563 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Dominik Stadler 2014-03-08 16:46:59 +00:00
parent 8c5115aeb1
commit 7e21a14172
2 changed files with 10 additions and 0 deletions

View File

@ -93,6 +93,7 @@ public class DateFormatConverter {
return result.toArray(new String[0]);
}
@Override
public String toString() {
StringBuilder result = new StringBuilder();
@ -323,6 +324,9 @@ public class DateFormatConverter {
result.put( "in", "[$-0421]" );
result.put( "iw", "[$-40D]" );
// JDK 8 adds an empty locale-string, see also https://issues.apache.org/jira/browse/LANG-941
result.put( "", "[$-0409]" );
return result;
}

View 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(""));
}
}