diff --git a/src/changes/changes.xml b/src/changes/changes.xml index 187b5f04c..72656570c 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -50,6 +50,7 @@ The type attribute can be add,update,fix,remove. Remove deprecation from RandomStringUtils ConstructorUtils.invokeConstructor(Class, Object...) regression EqualsBuilder#isRegistered: swappedPair construction bug + org.apache.commons.lang3.time.FastDateParser should use toUpperCase(Locale) diff --git a/src/main/java/org/apache/commons/lang3/time/FastDateParser.java b/src/main/java/org/apache/commons/lang3/time/FastDateParser.java index ac60d214e..8511bbaf3 100644 --- a/src/main/java/org/apache/commons/lang3/time/FastDateParser.java +++ b/src/main/java/org/apache/commons/lang3/time/FastDateParser.java @@ -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()); }