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

(cl) getBundle() basename string with leading "/" incompatible w/ JDK1.1

XMLWordPrintable


      If the path specified by the baseName argument to
      ResourceBundle.getBundle() begins with a leading slash, then the bundle
      is not found relative to the classpath.

      Clearly, the leading slash was inappropriate, however this did work
      previously and should continue to work in the same fashion.

      *** Security problem?? ***

      Where is the new code looking in this case? Is it looking
      outside the classpath? This represents a possible security problem
      in this case, because a properties file outside the classpath could
      be read. (Couldn't prove this.)


      ~>> * Problem description:
      ~>> The application cannot find its messages file, which we load using
      ~>> the method java.util.ResourceBundle.getBundle(), but it works with
      ~>> JDK 1.1.5. It is a file named "/vdbms/messages.properties". It's
      ~>> parent directory is on CLASSPATH, but the following call fails:
      ~>>
      ~>> ResourceBundle.getBundle("/vdbms/messages", Locale.getDefault())
      ~>>
      ~>> The exception is:
      ~>>
      ~>> java.util.MissingResourceException: can't find resource for
      ~>> /vdbms/messages.properties_en
      ~>> at java.lang.Throwable.<init>(Throwable.java:83)
      ~>> at java.lang.Exception.<init>(Exception.java:47)
      ~>> at java.lang.RuntimeException.<init>(RuntimeException.java:52)
      ~>> at
      ~>> java.util.MissingResourceException.<init>(MissingResourceException.java:51)
      ~>> at java.util.ResourceBundle.getBundle(ResourceBundle.java:383)
      ~>> at java.util.ResourceBundle.getBundle(ResourceBundle.java:315)
      ~>> at
      ~>junglee.vdbms.util.ResourceLoader.getBundle(ResourceLoader.java:285)
      ~>> at junglee.vdbms.util.ResourceLoader.main(ResourceLoader.java:342)
      ~>>
      ~>> If I call getBundle() with "vdbms/messages" instead of
      ~>> "/vdbms/messages" (i.e., if I remove the leading slash), it works.
      ~>>
      ~>> This seems to be a case where backward compatibility is not
      ~>> maintained with JDK 1.1 programs.

            iris Iris Clark
            foliversunw Fred Oliver (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: