diff --git a/fontbox/src/main/java/org/apache/fontbox/ttf/TTFDataStream.java b/fontbox/src/main/java/org/apache/fontbox/ttf/TTFDataStream.java index ce877a970e8..ae59bd84be3 100644 --- a/fontbox/src/main/java/org/apache/fontbox/ttf/TTFDataStream.java +++ b/fontbox/src/main/java/org/apache/fontbox/ttf/TTFDataStream.java @@ -32,6 +32,8 @@ */ abstract class TTFDataStream implements Closeable { + private static final TimeZone TIMEZONE_UTC = TimeZone.getTimeZone("UTC"); + TTFDataStream() { } @@ -208,7 +210,7 @@ public short readSignedShort() throws IOException public Calendar readInternationalDate() throws IOException { long secondsSince1904 = readLong(); - Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("UTC")); + Calendar cal = Calendar.getInstance(TIMEZONE_UTC); cal.set(1904, 0, 1, 0, 0, 0); cal.set(Calendar.MILLISECOND, 0); long millisFor1904 = cal.getTimeInMillis(); diff --git a/fontbox/src/main/java/org/apache/fontbox/ttf/TTFSubsetter.java b/fontbox/src/main/java/org/apache/fontbox/ttf/TTFSubsetter.java index f4bb96a5000..52ce8f36563 100755 --- a/fontbox/src/main/java/org/apache/fontbox/ttf/TTFSubsetter.java +++ b/fontbox/src/main/java/org/apache/fontbox/ttf/TTFSubsetter.java @@ -54,6 +54,8 @@ public final class TTFSubsetter private static final byte[] PAD_BUF = new byte[] { 0, 0, 0 }; + private static final TimeZone TIMEZONE_UTC = TimeZone.getTimeZone("UTC"); + private final TrueTypeFont ttf; private final CmapLookup unicodeCmap; private final SortedMap uniToGID; @@ -1084,7 +1086,7 @@ private void writeUint8(DataOutputStream out, int i) throws IOException private void writeLongDateTime(DataOutputStream out, Calendar calendar) throws IOException { // inverse operation of TTFDataStream.readInternationalDate() - Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("UTC")); + Calendar cal = Calendar.getInstance(TIMEZONE_UTC); cal.set(1904, 0, 1, 0, 0, 0); cal.set(Calendar.MILLISECOND, 0); long millisFor1904 = cal.getTimeInMillis();