LANG-799 - DateUtils#parseDate uses default locale; add Locale support

Parse German date with English Locale, specifying German Locale override

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@1388821 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Sebastian Bazley 2012-09-22 15:36:31 +00:00
parent 79c627478f
commit 12a0e3bdde
1 changed files with 12 additions and 0 deletions

View File

@ -1615,6 +1615,18 @@ public class DateUtilsTest {
}
}
// Parse German date with English Locale, specifying German Locale override
@Test
public void testLANG799_EN_WITH_DE_LOCALE() throws ParseException {
Locale dflt = Locale.getDefault();
Locale.setDefault(Locale.ENGLISH);
try {
DateUtils.parseDate("Mi, 09 Apr 2008 23:55:38 GMT", Locale.GERMAN, "EEE, dd MMM yyyy HH:mm:ss zzz");
} finally {
Locale.setDefault(dflt);
}
}
/**
* Retrieves a non-system locale date pattern string and attempts
* to use it.