-
Bug
-
Resolution: Duplicate
-
P1
-
None
-
1.4.0
-
x86
-
windows_nt
localedata.jar in extension dir is unusable only in windows JRE.
Please take a look at line #155 at sun.text.resource.LocaleData.java in jdk1.4.0 fcs build.
// add extensions from the extension class loader
ClassLoader appLoader = Launcher.getLauncher().getClassLoader();
URLClassLoader extLoader = (URLClassLoader) appLoader.getParent();
URL[] urls = extLoader.getURLs();
for (int i = 0; i < urls.length; i++) {
classPathSegments.insertElementAt(urls[i].getFile(), 0);
}
String[] classList = (String[])
java.security.AccessController.doPrivileged(
new java.security.PrivilegedAction() {
public Object run() {
return getClassList(PACKAGE, PREFIX);
}
});
URL.getFile() in LocaleData's createLocaleList returns %20 if there is a space
in URL string(in this case, the file path). And the return value of
URL.getFile() directly inputed to the class path segments which are tested whether they exist later. If it exists it will be searched for locale elements class.
private static String[] getClassList(String pkgName, String prefix) {
Vector listBuffer = new Vector();
String packagePath = pkgName.replace('.', File.separatorChar)
+ File.separatorChar;
String zipPackagePath = pkgName.replace('.', ZIPSEPARATOR)
+ ZIPSEPARATOR;
for (int i = 0; i < classPathSegments.size(); i++){
String onePath = (String) classPathSegments.elementAt(i);
File f = new File(onePath);
if (!f.exists())
continue;
if (f.isFile())
scanFile(f, zipPackagePath, listBuffer, prefix);
else if (f.isDirectory()) {
String fullPath;
if (onePath.endsWith(File.separator))
fullPath = onePath + packagePath;
else
fullPath = onePath + File.separatorChar + packagePath;
File dir = new File(fullPath);
if (dir.exists() && dir.isDirectory())
scanDir(dir, listBuffer, prefix);
}
}
String[] classNames = new String[listBuffer.size()];
listBuffer.copyInto(classNames);
return classNames;
}
However File class doesn't inteprete %20 as a space and File's exists() reports it does not exist.
To correct this problem, %20 should be converted to a space char and feed into
the class path segments vector.
(impact)
Depending on how access extension packages all extension jars could be unusable when extension path contains a space, which is true in windows jre. There are four extension jars files, dnsns.jar, ldapsec.jar, localedata.jar and sunjce_provider.jar in merlin. I don't know impacts on dnsns.jar, ldapsec.jar and sunjce_provider.jar in JRE. There should be investigation on these packages in windows JRE.
###@###.### 2002-02-19
- duplicates
-
JDK-4638772 REGRESSION: getAvailableLocales finds only en, en_US on Windows J2RE
- Closed