1
0
Fridrich Strba 2024-03-07 13:09:19 +00:00 committed by Git OBS Bridge
parent 7b450e6a53
commit 24a09eae1c
3 changed files with 8 additions and 70 deletions

View File

@ -1,63 +0,0 @@
--- 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) {

View File

@ -1,3 +1,11 @@
-------------------------------------------------------------------
Thu Mar 7 12:44:28 UTC 2024 - Fridrich Strba <fstrba@suse.com>
- Removed patch:
* alternative-tzdb_dat.patch
+ Remove the possibility to use the system timezone-java. It
creates more problems then it solves (bsc#1213470)
-------------------------------------------------------------------
Tue Feb 20 15:43:24 UTC 2024 - Fridrich Strba <fstrba@suse.com>

View File

@ -121,7 +121,6 @@ Patch201: system-libjpeg.patch
Patch202: system-libpng.patch
Patch203: system-lcms.patch
Patch210: openj9-no-werror.patch
Patch300: alternative-path-to-tzdb_dat.patch
BuildRequires: alsa-lib-devel
BuildRequires: autoconf
BuildRequires: automake
@ -227,7 +226,6 @@ Requires: jpackage-utils
Requires(post): update-alternatives
# Postun requires update-alternatives to uninstall tool update-alternatives.
Requires(postun): update-alternatives
Recommends: tzdata-java8
# Standard JPackage base provides.
Provides: java-%{javaver}-headless = %{version}-%{release}
Provides: java-headless = %{javaver}
@ -362,8 +360,6 @@ rm -rvf jdk/src/share/native/sun/java2d/cmm/lcms/lcms2*
%patch -P 32 -p1
%patch -P 300 -p1
cat %{SOURCE100} \
| sed "s/@OPENJ9_SHA@/`expr substr '%{openj9_revision}' 1 7`/g" \
| sed "s/@OPENJ9_BRANCH@/%{openj9_branch}/g" \
@ -439,9 +435,6 @@ find %{imagesdir}/j2sdk-image -iname '*.debuginfo' -exec rm {} \;
export JAVA_HOME=$(pwd)/%{imagesdir}/j2sdk-image
# Copy tz.properties
echo "sun.zoneinfo.dir=%{_datadir}/javazi" >> $JAVA_HOME/jre/lib/tz.properties
# cacerts are generated in runtime in openSUSE
if [ -f %{imagesdir}/j2sdk-image/jre/lib/security/cacerts ]; then
rm %{imagesdir}/j2sdk-image/jre/lib/security/cacerts