[LANG-1357] org.apache.commons.lang3.time.FastDateParser should use

toUpperCase(Locale)
This commit is contained in:
Gary Gregory 2017-10-09 14:30:07 -06:00
parent 00feb98f80
commit 4485491219
2 changed files with 7 additions and 6 deletions

View File

@ -50,6 +50,7 @@ The <action> type attribute can be add,update,fix,remove.
<action issue="LANG-1346" type="update" dev="pschumacher">Remove deprecation from RandomStringUtils</action>
<action issue="LANG-1350" type="fix" dev="ggregory" due-to="Brett Kail">ConstructorUtils.invokeConstructor(Class, Object...) regression</action>
<action issue="LANG-1349" type="fix" dev="pschumacher" due-to="Naman Nigam">EqualsBuilder#isRegistered: swappedPair construction bug</action>
<action issue="LANG-1357" type="fix" dev="ggregory" due-to="BruceKuiLiu">org.apache.commons.lang3.time.FastDateParser should use toUpperCase(Locale)</action>
</release>
<release version="3.6" date="2017-06-08" description="New features and bug fixes. Requires Java 7.">

View File

@ -887,15 +887,15 @@ public class FastDateParser implements DateParser, Serializable {
* {@inheritDoc}
*/
@Override
void setCalendar(final FastDateParser parser, final Calendar cal, final String value) {
if (value.charAt(0) == '+' || value.charAt(0) == '-') {
final TimeZone tz = TimeZone.getTimeZone("GMT" + value);
void setCalendar(final FastDateParser parser, final Calendar cal, final String timeZone) {
if (timeZone.charAt(0) == '+' || timeZone.charAt(0) == '-') {
final TimeZone tz = TimeZone.getTimeZone("GMT" + timeZone);
cal.setTimeZone(tz);
} else if (value.regionMatches(true, 0, "GMT", 0, 3)) {
final TimeZone tz = TimeZone.getTimeZone(value.toUpperCase());
} else if (timeZone.regionMatches(true, 0, "GMT", 0, 3)) {
final TimeZone tz = TimeZone.getTimeZone(timeZone.toUpperCase(Locale.ROOT));
cal.setTimeZone(tz);
} else {
final TzInfo tzInfo = tzNames.get(value.toLowerCase(locale));
final TzInfo tzInfo = tzNames.get(timeZone.toLowerCase(locale));
cal.set(Calendar.DST_OFFSET, tzInfo.dstOffset);
cal.set(Calendar.ZONE_OFFSET, tzInfo.zone.getRawOffset());
}