LANG-1092: Wrong formating of time zones with daylight saving time in FastDatePrinter
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@1666568 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
1f75a8f7cc
commit
8aa1b44ada
|
@ -22,6 +22,7 @@
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<release version="3.4" date="tba" description="tba">
|
<release version="3.4" date="tba" description="tba">
|
||||||
|
<action issue="LANG-1092" type="add" dev="britter">Wrong formating of time zones with daylight saving time in FastDatePrinter</action>
|
||||||
<action issue="LANG-877" type="add" dev="britter" due-to="Fabian Lange">Performance improvements for StringEscapeUtils</action>
|
<action issue="LANG-877" type="add" dev="britter" due-to="Fabian Lange">Performance improvements for StringEscapeUtils</action>
|
||||||
<action issue="LANG-1093" type="add" dev="britter" due-to="Fabian Lange">Add ClassUtils.getAbbreviatedName()</action>
|
<action issue="LANG-1093" type="add" dev="britter" due-to="Fabian Lange">Add ClassUtils.getAbbreviatedName()</action>
|
||||||
<action issue="LANG-1090" type="fix" dev="sebb">FastDateParser does not set error indication in ParsePosition</action>
|
<action issue="LANG-1090" type="fix" dev="sebb">FastDateParser does not set error indication in ParsePosition</action>
|
||||||
|
|
|
@ -1162,8 +1162,7 @@ public class FastDatePrinter implements DatePrinter, Serializable {
|
||||||
@Override
|
@Override
|
||||||
public void appendTo(final StringBuffer buffer, final Calendar calendar) {
|
public void appendTo(final StringBuffer buffer, final Calendar calendar) {
|
||||||
final TimeZone zone = calendar.getTimeZone();
|
final TimeZone zone = calendar.getTimeZone();
|
||||||
if (zone.useDaylightTime()
|
if (calendar.get(Calendar.DST_OFFSET) != 0) {
|
||||||
&& calendar.get(Calendar.DST_OFFSET) != 0) {
|
|
||||||
buffer.append(getTimeZoneDisplay(zone, true, mStyle, mLocale));
|
buffer.append(getTimeZoneDisplay(zone, true, mStyle, mLocale));
|
||||||
} else {
|
} else {
|
||||||
buffer.append(getTimeZoneDisplay(zone, false, mStyle, mLocale));
|
buffer.append(getTimeZoneDisplay(zone, false, mStyle, mLocale));
|
||||||
|
|
|
@ -265,12 +265,9 @@ public class FastDatePrinterTest {
|
||||||
final String[] availableZones = TimeZone.getAvailableIDs();
|
final String[] availableZones = TimeZone.getAvailableIDs();
|
||||||
final TimeZone currentZone = TimeZone.getDefault();
|
final TimeZone currentZone = TimeZone.getDefault();
|
||||||
|
|
||||||
TimeZone anotherZone = null;
|
|
||||||
for (final String zone : availableZones) {
|
for (final String zone : availableZones) {
|
||||||
if (!zone.equals(currentZone.getID())) {
|
if (!zone.equals(currentZone.getID())) {
|
||||||
anotherZone = TimeZone.getTimeZone(zone);
|
TimeZone anotherZone = TimeZone.getTimeZone(zone);
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
assertNotNull("Cannot find another timezone", anotherZone);
|
assertNotNull("Cannot find another timezone", anotherZone);
|
||||||
|
|
||||||
|
@ -283,6 +280,8 @@ public class FastDatePrinterTest {
|
||||||
final String actualValue = FastDateFormat.getInstance(pattern).format(cal);
|
final String actualValue = FastDateFormat.getInstance(pattern).format(cal);
|
||||||
assertEquals(expectedValue, actualValue);
|
assertEquals(expectedValue, actualValue);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testTimeZoneAsZ() throws Exception {
|
public void testTimeZoneAsZ() throws Exception {
|
||||||
|
|
Loading…
Reference in New Issue