I've learned a little more about this. Hopefully some of this will be
useful to people who want to work around the issue, or to Ubuntu package
managers who have the power to fix it.

The problem is that, when multiple versions of the JVM are installed,
the timezone directory (jre/lib/zi) is shared via a symlink. Presumably
this was done to save disk space, but it turns out to be a bad idea.
Each JVM should have its own copy of the timezone data.

So, for users, the most basic workaround is to replace the symlinked zi
directory with a copy. To give a specific example: On my machine, the
directory:

/usr/lib/jvm/ia32-java-6-sun-1.6.0.22/jre/lib/zi

is a symlink to

../../../java-6-sun-1.6.0.22/jre/lib/zi/

If i remove the symlink and copy the contents of the target dir to a new
(real) zi directory, the problem is fixed.

There is another workaround that does not involve copying files. The
downside is that you have to add a java System property to the command
line whenever you run a Java program: "-Dsun.io.useCanonCaches=false"
will do the trick.

The underlying problem is that Java (specifically
java.io.UnixFileSystem) has a caching mechanism that gets confused by
sym links that live under ${java.home}. Based on the comments in the
source file, the caching mechanism assumes that there are no symlinks
under ${java.home}, but that assumption is false on Ubuntu.

So, we seem to have 3 options:

1. Get the Java people to get rid of that assumption; or

2. Get Ubuntu to stop using symlinks under ${java.home}; or

3. Use the -Dsun.io.useCanonCaches=false system property to bypass the
broken caching system entirely.

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/591165

Title:
  TimeZone cannot find time zone if called after Class.getResource(..)

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to