Mercurial > hg > release > icedtea6-1.13
changeset 276:eceb31c1c47a cacao
* patches/icedtea-use-system-tzdata.patch: Use AccessController
instead of System.getProperty.
Catch AccessControlException while attempting to stat
ZoneInfoMappings.
author | Keith Seitz <keiths@redhat.com> |
---|---|
date | Wed, 03 Oct 2007 15:38:04 -0700 |
parents | bdc055df3bc9 |
children | 5578f6fee3c7 |
files | ChangeLog patches/icedtea-use-system-tzdata.patch |
diffstat | 2 files changed, 44 insertions(+), 27 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Wed Oct 03 14:46:43 2007 -0400 +++ b/ChangeLog Wed Oct 03 15:38:04 2007 -0700 @@ -1,3 +1,10 @@ +2007-10-03 Keith Seitz <keiths@redhat.com> + + * patches/icedtea-use-system-tzdata.patch: Use AccessController + instead of System.getProperty. + Catch AccessControlException while attempting to stat + ZoneInfoMappings. + 2007-10-03 Matthias Klose <doko@ubuntu.com> * Makefile.am: Use DISTRIBUTION_PATCHES and gcc-suffix.
--- a/patches/icedtea-use-system-tzdata.patch Wed Oct 03 14:46:43 2007 -0400 +++ b/patches/icedtea-use-system-tzdata.patch Wed Oct 03 15:38:04 2007 -0700 @@ -1,19 +1,27 @@ -diff -r 7afa92fca0fd hotspot/src/os/linux/vm/os_linux.cpp ---- openjdk/hotspot/src/os/linux/vm/os_linux.cpp Thu Sep 27 12:57:09 2007 -0700 -+++ openjdk/hotspot/src/os/linux/vm/os_linux.cpp Thu Sep 27 14:00:27 2007 -0700 -@@ -391,6 +391,9 @@ void os::init_system_properties_values() +--- openjdk/hotspot/src/os/linux/vm/os_linux.cpp.keiths 2007-10-03 08:39:51.000000000 -0700 ++++ openjdk/hotspot/src/os/linux/vm/os_linux.cpp 2007-10-03 08:41:49.000000000 -0700 +@@ -391,6 +391,10 @@ void os::init_system_properties_values() "javax.net.ssl.trustStorePassword", ""); + // Use the system zoneinfo files, if present + Arguments::PropertyList_add (&sp, + "user.zoneinfo.dir", "/usr/share/javazi"); ++ #undef malloc #undef getenv #undef EXTENSIONS_DIR ---- ../openjdk-b21/openjdk/j2se/src/share/classes/sun/util/calendar/ZoneInfoFile.java 2007-09-27 22:30:36.000000000 -0400 -+++ openjdk/j2se/src/share/classes/sun/util/calendar/ZoneInfoFile.java 2007-09-28 11:24:52.000000000 -0400 -@@ -1021,11 +1021,25 @@ +--- openjdk/j2se/src/share/classes/sun/util/calendar/ZoneInfoFile.java.keiths 2007-10-03 13:42:51.000000000 -0700 ++++ openjdk/j2se/src/share/classes/sun/util/calendar/ZoneInfoFile.java 2007-10-03 13:42:57.000000000 -0700 +@@ -30,6 +30,7 @@ import java.io.FileInputStream; + import java.io.FileNotFoundException; + import java.io.IOException; + import java.lang.ref.SoftReference; ++import java.security.AccessControlException; + import java.security.AccessController; + import java.security.PrivilegedAction; + import java.security.PrivilegedActionException; +@@ -1021,10 +1022,28 @@ public class ZoneInfoFile { byte[] buffer = null; try { @@ -21,26 +29,28 @@ - new sun.security.action.GetPropertyAction("java.home")); - final String fname = homeDir + File.separator + "lib" + File.separator - + "zi" + File.separator + fileName; -- buffer = (byte[]) AccessController.doPrivileged(new PrivilegedExceptionAction() { -+ String zi_dir = (String) System.getProperty("user.zoneinfo.dir"); -+ File dir = null; -+ if (zi_dir != null) -+ dir = new File(zi_dir); -+ -+ // Some minimal sanity checking -+ if (dir != null) { -+ File f = new File(dir, "ZoneInfoMappings"); -+ if (!f.exists()) -+ dir = null; -+ } ++ String zi_dir = (String) AccessController.doPrivileged(new sun.security.action.GetPropertyAction("user.zoneinfo.dir")); ++ File dir = null; ++ if (zi_dir != null) ++ dir = new File(zi_dir); + -+ if (dir == null) { -+ String homeDir = (String) System.getProperty("java.home"); -+ zi_dir = homeDir + File.separator + "lib" + File.separator -+ + "zi"; -+ } -+ final String fname = zi_dir + File.separator + fileName; -+ buffer = (byte[]) AccessController.doPrivileged(new PrivilegedExceptionAction() { ++ // Some minimal sanity checking ++ if (dir != null) { ++ try { ++ File f = new File(dir, "ZoneInfoMappings"); ++ if (!f.exists()) ++ dir = null; ++ } catch (AccessControlException ace) { ++ dir = null; ++ } ++ } ++ ++ if (dir == null) { ++ String homeDir = (String) AccessController.doPrivileged(new sun.security.action.GetPropertyAction("java.home")); ++ zi_dir = homeDir + File.separator + "lib" + File.separator ++ + "zi"; ++ } ++ final String fname = zi_dir + File.separator + fileName; + buffer = (byte[]) AccessController.doPrivileged(new PrivilegedExceptionAction() { public Object run() throws IOException { File file = new File(fname); - if (!file.canRead()) {