Hi,

The JRE contains pre-compiled timezone information files. As an OS
vendor, Red Hat would prefer not to respin or repackage the JRE every
time tzdata changes somewhere in the world.

In order to facilitate this, we're in the process of modifying our
tzdata package to include pre-compiled zoneinfo files for use with JREs.
I have created a patch to the openjdk JRE that would optionally use
these files instead of the pre-packaged ones in the JRE.

We would really like to solicit advice/comments about how to get
something like this accepted upstream so that other distros can use this.

Keith

--- openjdk/hotspot/src/os/linux/vm/os_linux.cpp.keiths	2007-08-01 10:21:19.000000000 -0700
+++ openjdk/hotspot/src/os/linux/vm/os_linux.cpp	2007-08-01 10:21:36.000000000 -0700
@@ -376,6 +376,10 @@
     }
   }
 
+  // Use the system zoneinfo files, if present
+  SystemProperty* sp = Arguments::system_properties();
+  Arguments::PropertyList_add (&sp,
+			       "java.zoneinfo.dir", "/usr/share/zoneinfo/java");
 #undef malloc
 #undef getenv
 #undef EXTENSIONS_DIR
--- openjdk/j2se/src/share/classes/sun/util/calendar/ZoneInfoFile.java.keiths	2007-08-01 12:31:03.000000000 -0700
+++ openjdk/j2se/src/share/classes/sun/util/calendar/ZoneInfoFile.java	2007-08-01 12:29:44.000000000 -0700
@@ -1021,10 +1021,18 @@
 	byte[] buffer = null;
 
 	try {
-	    String homeDir = (String) AccessController.doPrivileged(
+	    String zi_dir = (String) AccessController.doPrivileged(
+			        new sun.security.action.GetPropertyAction("java.zoneinfo.dir"));
+	    File dir = null;
+	    if (zi_dir != null)
+	      dir = new File(zi_dir);
+	    if (dir == null || !dir.exists() || !dir.isDirectory()) {
+	      String homeDir = (String) AccessController.doPrivileged(
 				new sun.security.action.GetPropertyAction("java.home"));
-	    final String fname = homeDir + File.separator + "lib" + File.separator
-				 + "zi" + File.separator + fileName;
+	      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);

Reply via email to