forked from pool/java-1_8_0-openj9
3c90febd1f
OBS-URL: https://build.opensuse.org/request/show/768300 OBS-URL: https://build.opensuse.org/package/show/Java:Factory/java-1_8_0-openj9?expand=0&rev=15
64 lines
2.6 KiB
Diff
64 lines
2.6 KiB
Diff
--- a/jdk/src/share/classes/sun/util/calendar/ZoneInfoFile.java 2020-01-22 11:12:33.000000000 +0100
|
|
+++ b/jdk/src/share/classes/sun/util/calendar/ZoneInfoFile.java 2020-01-29 09:40:23.558260593 +0100
|
|
@@ -31,6 +31,7 @@
|
|
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;
|
|
@@ -47,6 +48,7 @@
|
|
import java.util.Map;
|
|
import java.util.Map.Entry;
|
|
import java.util.Objects;
|
|
+import java.util.Properties;
|
|
import java.util.Set;
|
|
import java.util.SimpleTimeZone;
|
|
import java.util.concurrent.ConcurrentHashMap;
|
|
@@ -251,7 +253,15 @@
|
|
AccessController.doPrivileged(new PrivilegedAction<Object>() {
|
|
public Object run() {
|
|
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"))))) {
|
|
@@ -264,6 +274,27 @@
|
|
}
|
|
});
|
|
}
|
|
+
|
|
+ private static String getZoneInfoDir(final String libDir) {
|
|
+ return AccessController.doPrivileged (new PrivilegedAction<String>() {
|
|
+ public String run() {
|
|
+ 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;
|
|
+ }
|
|
+ }
|
|
+ });
|
|
+ }
|
|
|
|
private static void addOldMapping() {
|
|
for (String[] alias : oldMappings) {
|