diff --git a/src/main/java/org/apache/commons/lang3/time/GmtTimeZone.java b/src/main/java/org/apache/commons/lang3/time/GmtTimeZone.java index f9ba1cb2e..03a836a5b 100644 --- a/src/main/java/org/apache/commons/lang3/time/GmtTimeZone.java +++ b/src/main/java/org/apache/commons/lang3/time/GmtTimeZone.java @@ -45,10 +45,13 @@ class GmtTimeZone extends TimeZone { } final int milliseconds = (minutes + (hours * MINUTES_PER_HOUR)) * MILLISECONDS_PER_MINUTE; offset = negate ? -milliseconds : milliseconds; - zoneId = twoDigits( - twoDigits(new StringBuilder(9).append("GMT").append(negate ? '-' : '+'), hours) - .append(':'), minutes).toString(); - + // @formatter:off + zoneId = twoDigits(twoDigits(new StringBuilder(9) + .append(TimeZones.GMT_ID) + .append(negate ? '-' : '+'), hours) + .append(':'), minutes) + .toString(); + // @formatter:on } private static StringBuilder twoDigits(final StringBuilder sb, final int n) { diff --git a/src/test/java/org/apache/commons/lang3/time/FastDateParserTest.java b/src/test/java/org/apache/commons/lang3/time/FastDateParserTest.java index 5d7535f79..f37b60a8b 100644 --- a/src/test/java/org/apache/commons/lang3/time/FastDateParserTest.java +++ b/src/test/java/org/apache/commons/lang3/time/FastDateParserTest.java @@ -90,7 +90,7 @@ public class FastDateParserTest { private static final TimeZone REYKJAVIK = TimeZone.getTimeZone("Atlantic/Reykjavik"); private static final TimeZone NEW_YORK = TimeZone.getTimeZone("America/New_York"); - static final TimeZone GMT = TimeZone.getTimeZone("GMT"); + static final TimeZone GMT = TimeZone.getTimeZone(TimeZones.GMT_ID); private static final TimeZone INDIA = TimeZone.getTimeZone("Asia/Calcutta"); private static final Locale SWEDEN = new Locale("sv", "SE"); diff --git a/src/test/java/org/apache/commons/lang3/time/FastDatePrinterTest.java b/src/test/java/org/apache/commons/lang3/time/FastDatePrinterTest.java index 8a68720f4..c8837d2d1 100644 --- a/src/test/java/org/apache/commons/lang3/time/FastDatePrinterTest.java +++ b/src/test/java/org/apache/commons/lang3/time/FastDatePrinterTest.java @@ -60,7 +60,7 @@ public class FastDatePrinterTest { } private static final String YYYY_MM_DD = "yyyy/MM/dd"; private static final TimeZone NEW_YORK = TimeZone.getTimeZone("America/New_York"); - private static final TimeZone GMT = TimeZone.getTimeZone("GMT"); + private static final TimeZone GMT = TimeZone.getTimeZone(TimeZones.GMT_ID); private static final TimeZone INDIA = TimeZone.getTimeZone("Asia/Calcutta"); private static final Locale SWEDEN = new Locale("sv", "SE"); @@ -126,7 +126,7 @@ public class FastDatePrinterTest { @Test public void testAppendableOptions() { - final DatePrinter format = getInstance("yyyy-MM-dd HH:mm:ss.SSS Z", TimeZone.getTimeZone("GMT")); + final DatePrinter format = getInstance("yyyy-MM-dd HH:mm:ss.SSS Z", TimeZone.getTimeZone(TimeZones.GMT_ID)); final Calendar calendar = Calendar.getInstance(); final StringBuilder sb = new StringBuilder(); final String expected = format.format(calendar, sb).toString(); @@ -262,7 +262,7 @@ public class FastDatePrinterTest { cal.clear(); cal.set(2009, Calendar.OCTOBER, 16, 8, 42, 16); - final DatePrinter format = getInstance("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'", TimeZone.getTimeZone("GMT")); + final DatePrinter format = getInstance("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'", TimeZone.getTimeZone(TimeZones.GMT_ID)); assertEquals("2009-10-16T16:42:16.000Z", format.format(cal.getTime()), "dateTime"); assertEquals("2009-10-16T16:42:16.000Z", format.format(cal), "dateTime"); } @@ -387,7 +387,7 @@ public class FastDatePrinterTest { @SuppressWarnings("deprecation") @Test public void testStringBufferOptions() { - final DatePrinter format = getInstance("yyyy-MM-dd HH:mm:ss.SSS Z", TimeZone.getTimeZone("GMT")); + final DatePrinter format = getInstance("yyyy-MM-dd HH:mm:ss.SSS Z", TimeZone.getTimeZone(TimeZones.GMT_ID)); final Calendar calendar = Calendar.getInstance(); final StringBuffer sb = new StringBuffer(); final String expected = format.format(calendar, sb, new FieldPosition(0)).toString(); diff --git a/src/test/java/org/apache/commons/lang3/time/FastTimeZoneTest.java b/src/test/java/org/apache/commons/lang3/time/FastTimeZoneTest.java index 69ced394b..7690051af 100644 --- a/src/test/java/org/apache/commons/lang3/time/FastTimeZoneTest.java +++ b/src/test/java/org/apache/commons/lang3/time/FastTimeZoneTest.java @@ -34,7 +34,7 @@ public class FastTimeZoneTest { @Test public void testBareGmt() { - assertEquals(FastTimeZone.getGmtTimeZone(), FastTimeZone.getTimeZone("GMT")); + assertEquals(FastTimeZone.getGmtTimeZone(), FastTimeZone.getTimeZone(TimeZones.GMT_ID)); } @Test