EVALUATION
The symptom appears only on 1.4.2. 1.4.1 and 1.5.0 appear to be fine.
I think the source code for the class loader was inadvertently omitted.
It would be good to provide that as well.
There seems to be circular dependency here. A classloader needs to
load files from disks, but filenames and file contents are byte sequences
that must be decoded, and for non-built-in encodings, they may be provided
by an external party, which needs to be found using a classloader...
###@###.### 2004-09-24
after some code comparison between 1.4.2 and 1.5.0 it seems this diff
is able to make the test case work. the reason is that after the change
the StandardProvider.charsetForName in java.nio.charset.Charset will
succeed and so it wont go further. still there seems to be a
flaw to me that if it does go thru we will still hit the same problem.
------- StandardCharsets.java -------
*** /tmp/sccs.s1aWfn Tue Sep 28 18:59:25 2004
--- StandardCharsets.java Tue Sep 28 18:56:24 2004
***************
*** 100,105 ****
--- 100,106 ----
charset("ISO-8859-2", "ISO_8859_2",
new String[] {
"iso8859_2", // JDK historical
+ "ISO8859-2",
"iso-ir-101",
"ISO_8859-2",
"ISO_8859-2:1987",
###@###.### 2004-09-28
This is very interesting. The story with charsets is particularly
confusing because there are old-style "io" and new-style "nio"
charsets, and they work differently.
I also fear that we may fix iso8859-2, and yet have other charsets
broken. iso8859-3 does *not* appear to be a "standard" charset in
1.5.0.
Be careful! In 1.5.0 StandardCharsets.java is a generated file.
Patches to it would be wrong. You need to edit the true source.
###@###.### 2004-09-28
verified in 1.4.2_07 on solaris 9 (sparc).
###@###.### 2004-11-05
###@###.### 2004-11-05 15:21:44 GMT
As Martin had apprehended, this fix had remained broken on "ja" locale.
np156323@bongo1>java -version
java version "1.4.2_07"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_07-b05)
Java HotSpot(TM) Client VM (build 1.4.2_07-b05, mixed mode)
np156323@bongo1>locale
LANG=ja
LC_CTYPE="ja"
LC_NUMERIC="ja"
LC_TIME="ja"
LC_COLLATE="ja"
LC_MONETARY="ja"
LC_MESSAGES="ja"
LC_ALL=
np156323@bongo1>java -Djava.system.class.loader=workshop.core.AppClassLoader -cp .:ClassLoader.jar Test
*****Starting AppClassLoader
java.lang.IllegalStateException: recursive invocation
at java.lang.ClassLoader.initSystemClassLoader(ClassLoader.java:1139)
at java.lang.ClassLoader.getSystemClassLoader(ClassLoader.java:1122)
at java.nio.charset.Charset$1.<init>(Charset.java:297)
at java.nio.charset.Charset.providers(Charset.java:294)
at java.nio.charset.Charset.access$000(Charset.java:245)
at java.nio.charset.Charset$2.run(Charset.java:362)
at java.security.AccessController.doPrivileged(Native Method)
at java.nio.charset.Charset.lookupViaProviders(Charset.java:359)
at java.nio.charset.Charset.lookup2(Charset.java:437)
at java.nio.charset.Charset.lookup(Charset.java:425)
at java.nio.charset.Charset.isSupported(Charset.java:463)
at java.lang.StringCoding.lookupCharset(StringCoding.java:82)
at java.lang.StringCoding.decode(StringCoding.java:211)
at java.lang.StringCoding.decode(StringCoding.java:230)
at java.lang.String.<init>(String.java:371)
at java.lang.String.<init>(String.java:390)
at java.io.UnixFileSystem.canonicalize0(Native Method)
at java.io.UnixFileSystem.canonicalize(UnixFileSystem.java:157)
at java.io.File.getCanonicalPath(File.java:513)
at java.io.File.getCanonicalFile(File.java:534)
at sun.misc.Launcher.getFileURL(Launcher.java:389)
at sun.misc.Launcher.pathToURLs(Launcher.java:332)
at sun.misc.Launcher.access$300(Launcher.java:37)
at sun.misc.Launcher$3.run(Launcher.java:319)
at java.security.AccessController.doPrivileged(Native Method)
at sun.misc.Launcher.getBootstrapClassPath(Launcher.java:316)
at java.lang.ClassLoader.getBootstrapClassPath(ClassLoader.java:973)
at java.lang.ClassLoader.getBootstrapResource(ClassLoader.java:948)
at java.lang.ClassLoader.getResource(ClassLoader.java:810)
at java.lang.ClassLoader.getResource(ClassLoader.java:808)
at workshop.core.AppClassLoader$PatchUtil.initializeDir(AppClassLoader.java:454)
at workshop.core.AppClassLoader$PatchUtil.newFile(AppClassLoader.java:488)
at workshop.core.AppClassLoader$PatchUtil.getPatchList(AppClassLoader.java:379)
at workshop.core.AppClassLoader.<init>(AppClassLoader.java:113)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:274)
at java.lang.SystemClassLoaderAction.run(ClassLoader.java:1853)
at java.security.AccessController.doPrivileged(Native Method)
at java.lang.ClassLoader.initSystemClassLoader(ClassLoader.java:1147)
at java.lang.ClassLoader.getSystemClassLoader(ClassLoader.java:1122)
Error occurred during initialization of VM
java.lang.Error: java.lang.IllegalStateException: recursive invocation
###@###.### 2005-03-02 15:05:38 GMT
Bug seem to have been fixed on 1.4.2_08_b02 for ja locale.
np156323@bongo1>locale
LANG=ja
LC_CTYPE="ja"
LC_NUMERIC="ja"
LC_TIME="ja"
LC_COLLATE="ja"
LC_MONETARY="ja"
LC_MESSAGES="ja"
LC_ALL=
np156323@bongo1>export PATH=/net/jre.sfbay/p/v09/jdk/1.4.2_08/fcs/b02/binaries/solars-sparc/bin:$PATH
np156323@bongo1>which java
/net/jre.sfbay/p/v09/jdk/1.4.2_08/fcs/b02/binaries/solaris-sparc/bin/java
np156323@bongo1>java -Djava.system.class.loader=workshop.core.AppClassLoader -cp .:CassLoader.jar Test
*****Starting AppClassLoader
*****Adding system classpath: .:ClassLoader.jar
done!!!!
np156323@bongo1>java -version
java version "1.4.2_08"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_08-b02)
Java HotSpot(TM) Client VM (build 1.4.2_08-b02, mixed mode)
###@###.### 2005-03-02 15:09:26 GMT
|