62 lines
2.4 KiB
Diff
62 lines
2.4 KiB
Diff
--- openjdk/jdk/src/share/classes/java/time/zone/TzdbZoneRulesProvider.java 2017-10-30 18:28:40.000000000 +0100
|
|
+++ openjdk/jdk/src/share/classes/java/time/zone/TzdbZoneRulesProvider.java 2017-11-03 11:51:41.617320377 +0100
|
|
@@ -74,6 +74,7 @@
|
|
import java.util.Map;
|
|
import java.util.NavigableMap;
|
|
import java.util.Objects;
|
|
+import java.util.Properties;
|
|
import java.util.Set;
|
|
import java.util.TreeMap;
|
|
import java.util.concurrent.ConcurrentHashMap;
|
|
@@ -106,7 +107,15 @@
|
|
*/
|
|
public TzdbZoneRulesProvider() {
|
|
try {
|
|
- String libDir = System.getProperty("java.home") + File.separator + "lib";
|
|
+ final String homeDir = System.getProperty("java.home");
|
|
+ if (homeDir == null) {
|
|
+ throw new Error("java.home is not set");
|
|
+ }
|
|
+ String libDir = homeDir + File.separator + "lib";
|
|
+ String otherDir = getZoneInfoDir(libDir);
|
|
+ if (otherDir != null)
|
|
+ libDir = otherDir;
|
|
+
|
|
try (DataInputStream dis = new DataInputStream(
|
|
new BufferedInputStream(new FileInputStream(
|
|
new File(libDir, "tzdb.dat"))))) {
|
|
@@ -117,6 +126,23 @@
|
|
}
|
|
}
|
|
|
|
+ private static String getZoneInfoDir(final String libDir) {
|
|
+ File f = new File(libDir + File.separator + "tz.properties");
|
|
+ try (BufferedInputStream bin = new BufferedInputStream(new FileInputStream(f))) {
|
|
+ Properties props = new Properties();
|
|
+ props.load(bin);
|
|
+ String dir = props.getProperty("sun.zoneinfo.dir");
|
|
+ if (dir == null)
|
|
+ return null;
|
|
+ File tzdbdat = new File(dir, "tzdb.dat");
|
|
+ if (tzdbdat.exists())
|
|
+ return dir;
|
|
+ return null;
|
|
+ } catch (Exception x) {
|
|
+ return null;
|
|
+ }
|
|
+ }
|
|
+
|
|
@Override
|
|
protected Set<String> provideZoneIds() {
|
|
return new HashSet<>(regionIds);
|
|
--- openjdk/jdk/src/share/classes/sun/util/calendar/ZoneInfoFile.java 2017-10-30 18:28:40.000000000 +0100
|
|
+++ openjdk/jdk/src/share/classes/sun/util/calendar/ZoneInfoFile.java 2017-11-03 11:18:55.381711882 +0100
|
|
@@ -31,7 +31,6 @@
|
|
import java.io.DataInputStream;
|
|
import java.io.File;
|
|
import java.io.FileInputStream;
|
|
-import java.io.InputStream;
|
|
import java.io.IOException;
|
|
import java.io.StreamCorruptedException;
|
|
import java.security.AccessController;
|