JDK-6249364 : "!" (exclamation) in directory of jar containing ResourceBundle Fails
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.net
  • Affected Version: 5.0
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_xp
  • CPU: x86
  • Submitted: 2005-04-01
  • Updated: 2011-02-16
  • Resolved: 2005-10-12
Related Reports
Duplicate :  
Description
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

Comments
EVALUATION I've checked this with mustang b55 and it is fixed. It is a dup of 4523159
12-10-2005