Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-15:Update
java-10-openjdk
alternative-tzdb_dat.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File alternative-tzdb_dat.patch of Package java-10-openjdk
--- jdk10/src/java.base/share/classes/java/time/zone/TzdbZoneRulesProvider.java 2017-11-02 11:16:27.000000000 +0100 +++ jdk10/src/java.base/share/classes/java/time/zone/TzdbZoneRulesProvider.java 2017-11-03 16:52:53.648612650 +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,14 @@ */ 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(homeDir); + if (otherDir != null) + libDir = otherDir; try (DataInputStream dis = new DataInputStream( new BufferedInputStream(new FileInputStream( new File(libDir, "tzdb.dat"))))) { @@ -117,6 +125,28 @@ } } + private static String getZoneInfoDir(final String homeDir) { + try { + File f = new File(homeDir + File.separator + "conf" + + File.separator + "tz.properties"); + if (!f.exists()) + return null; + BufferedInputStream bin = new BufferedInputStream(new FileInputStream(f)); + Properties props = new Properties(); + props.load(bin); + bin.close(); + 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); --- jdk10/src/java.base/share/classes/sun/util/calendar/ZoneInfoFile.java 2017-11-02 11:16:27.000000000 +0100 +++ jdk10/src/java.base/share/classes/sun/util/calendar/ZoneInfoFile.java 2017-11-03 16:52:53.648612650 +0100 @@ -47,6 +47,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; @@ -252,7 +253,15 @@ AccessController.doPrivileged(new PrivilegedAction<Void>() { public Void 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(homeDir); + if (otherDir != null) + libDir = otherDir; + try (DataInputStream dis = new DataInputStream( new BufferedInputStream(new FileInputStream( new File(libDir, "tzdb.dat"))))) { @@ -266,6 +275,28 @@ }); } + private static String getZoneInfoDir(final String homeDir) { + try { + File f = new File(homeDir + File.separator + "conf" + + File.separator + "tz.properties"); + if (!f.exists()) + return null; + BufferedInputStream bin = new BufferedInputStream(new FileInputStream(f)); + Properties props = new Properties(); + props.load(bin); + bin.close(); + 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) { aliases.put(alias[0], alias[1]);
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor