Java Solaris Communities Sun Store Join SDN My Profile Why Join?
 
Bug Database
Bug Detail
Quick Lists
Top 25 Bugs
Top 25 RFE's
Recently Closed Bugs
Printable Page Printable Page


Bug Database
Bug ID: 4834404
Votes 2
Synopsis UIDefaults can't find resource bundles from app classloader
Category java:classes_swing
Reported Against 1.4.1
Release Fixed
State 6-Fix Understood, bug
Priority: 4-Low
Related Bugs
Submit Date 19-MAR-2003
Description




FULL PRODUCT VERSION :
java version "1.4.1_01"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1_01-b01)
Java HotSpot(TM) Client VM (build 1.4.1_01-b01, mixed mode)

FULL OPERATING SYSTEM VERSION :
Windows NT Version 4.0

A DESCRIPTION OF THE PROBLEM :
There is a problem with the way that the UIdefaults class
finds ResourceBundles.

Broadly, some application code is running in
classloader A.  If the application code calls
ResourceBundle.getBundle, then there is some magic
code in ResourceBundle that determines that the
caller is in classloader A and ResourceBundle then
uses ClassLoader A to find the resource bundle.

However, if the app code calls addResourceBundle(), then
calls one of UIDefaults methods to get a UI resource from
the added resource bundle, such as using the get(Object
key, Locale locale) method. The UIDefaults class will then
call ResourceBundle.getBundle, then the ResourceBundle
code will see that the call is coming from code
using the system classloader, and will use the
system classloader (rather than classloader A)
to find the bundle.

For apps started by JavaWebStart, the app is running with
its resources in a different classloader than the system
classloader. And thus the problem occurs.

I think a solution similar to the one developped for bug ID
4418820 should be used.

REPRODUCIBILITY :
This bug can be reproduced always.

CUSTOMER WORKAROUND :
One could always try to load the resource bundles for the
appropriate locale and add the content of the resource
bundles to the UIDefaults class using put() or putDefaults
().
(Review ID: 179181) 
======================================================================
Work Around
N/A
Evaluation
addResourceBundle was intended for internal use only, therefor it doesn't
correctly resolve non-system resource bundles.
To fix this we could cache the context ClassLoader at the tiem addResourceBundle
is called.
  xxxxx@xxxxx   2003-03-19
Comments
  
  Include a link with my name & email   

Submitted On 23-JUN-2003
Markus Karg QUIPSY
I have a similar problem with this constellation:
- A is the main app jar.
- B is some jar containing utility code.
- A is the JNLP main app.
- A calls a method in a class in B.
- That method wants to load a java.util.ResourceBundle.
- That bundle resides in A.
- Result: JNLP Class Loader cannot find the bundle.


Submitted On 07-DEC-2003
Markus Karg QUIPSY
Related to this bug report might be this problem:
Loading ressource bundle doesn't work with 
JNLP-deployed applications, if the resource contains 
static initializers. E. g. you cannot declare a static 
singleton object for the content of the bundle, and 
return that content in getContents. This leads to bundle 
not found problems in JNLP-deployed apps.



PLEASE NOTE: JDK6 is formerly known as Project Mustang