Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4639932

localedata.jar maybe unusable in windows jre

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P1
    • Resolution: Duplicate
    • Affects Version/s: 1.4.0
    • Fix Version/s: None
    • Component/s: core-libs
    • Labels:

      Description


      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

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              nlindenbsunw Norbert Lindenberg (Inactive)
              Reporter:
              bkimsunw Bae-chul Kim (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: