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

"!" (exclamation) in directory of jar containing ResourceBundle Fails

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P3 P3
    • None
    • 5.0
    • core-libs
    • x86
    • windows_xp

      FULL PRODUCT VERSION :
      C:\z-harvest\AHarwebInstall\Build\!test>java -version
      java version "1.5.0_01"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_01-b08)
      Java HotSpot(TM) Client VM (build 1.5.0_01-b08, mixed mode, sharing)

      ADDITIONAL OS VERSION INFORMATION :
      C:\z-harvest\AHarwebInstall\Build\!test>ver

      Microsoft Windows XP [Version 5.1.2600]

      EXTRA RELEVANT SYSTEM CONFIGURATION :
      My working directory, containing the executable jar, is:
      C:\z-harvest\AHarwebInstall\Build\!test

      A DESCRIPTION OF THE PROBLEM :
      My working directory contains a "!" (exclamation) in the name.

      ResourceBundle.getBundle() causes an exception when the application is launched from the application jar.

      If the application is unpackaged and run - the application works properly.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Create a simple class that reads a String from a properties file.
      - ResourceBundle.getBundle("test");

      Package the Java class and the properties file together in a Jar, and add an entry in the Manifest for the Main-Class.

      - Place the jar in a directory with an exclamation mark in the name
      (i.e. !a).
      - Execute "java -jar <jar name>" from the command line.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      There should be no exception, and the application should run normally.
      ACTUAL -
      The application terminates with an exception.

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      C:\z-harvest\AHarwebInstall\Build\!test>java -jar C:\z-harvest\AHarwebInstall\Build\!test\HarwebInstall.jar
      Exception in thread "main" java.lang.ExceptionInInitializerError
              at com.ca.harvest.wizard.harwebinstall.HarwebInstall.main(HarwebInstall.
      java:42)
      Caused by: java.util.MissingResourceException: Can't find bundle for base name com.ca.harvest.wizard.harwebinstall.HarwebInstallWizard, locale en_US
              at java.util.ResourceBundle.throwMissingResourceException(Unknown Source)
              at java.util.ResourceBundle.getBundleImpl(Unknown Source)
              at java.util.ResourceBundle.getBundle(Unknown Source)
              at com.ca.harvest.wizard.harwebinstall.HarwebInstallWizard.<clinit>(Harw
      ebInstallWizard.java:29)
              ... 1 more

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      Test.java
      -------------
      import java.util.*;
      public class Test
      {
          private static ResourceBundle bundle = ResourceBundle
                  .getBundle("test");

          public Test() {}
      }


      test.properties
      --------------------
      a=b
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      Unpackage jar file.

      Don't use "!" (exclamation)
      ###@###.### 2005-04-01 17:11:24 GMT

            michaelm Michael McMahon
            ndcosta Nelson Dcosta (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: