[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [equinox-dev] Accessing ResourceBundles from a bundle

Correct BJ.

This is what I raised as an issue regarding ResourceBundle when we were all together
in Ottawa. Remember?

I added the support on a bundle to support finding the resource across the
different class loaders of a bundle, including fragment support.

This is part of looking at Bundle like a replacement for the functionality of ClassLoaders:

        - find resources
        - get ResourceBundle
        - load classes

Best regards,

Olivier Gruber, Ph.D.
Persistent & Distributed Object Platforms and Frameworks
IBM TJ Watson Research Center

BJ Hargrave/Austin/IBM@IBMUS
Sent by: equinox-dev-admin@xxxxxxxxxxx

07/18/2003 11:47 AM

        To:        "Pascal Rapicault" <Pascal_Rapicault@xxxxxxxxxx>
        cc:        equinox-dev@xxxxxxxxxxx
        Subject:        Re: [equinox-dev] Accessing ResourceBundles from a bundle

From looking at the ResourceBundle class, ResourceBundle.getBundle(String) will use the context class loader of the caller to locate the resource bundle. This means it will use the classloader of the bundle which loaded the class which defines the method which calls ResourceBundle.getBundle(String).

So if the class which defines the method comes from a different bundle (imported package) than the resource, the resource probably will not be located.

BJ Hargrave
Senior Software Engineer, IBM Pervasive Computing - Austin, TX
OSGi Fellow and CTO of the OSGi Alliance
mailto:hargrave@xxxxxxxxxx  902/6C-003 T/L 678-9938
Office: +1 512 838 9938  Mobile: +1 512 785 7386

"Pascal Rapicault" <Pascal_Rapicault@xxxxxxxxxx>
Sent by: equinox-dev-admin@xxxxxxxxxxx

2003-07-18 10:32 AM

       To:        equinox-dev@xxxxxxxxxxx


       Subject:        [equinox-dev] Accessing ResourceBundles from a bundle


Is there any knwon problem using the java API   ResourceBundle.getResourceBundle(String baseName) from the code of a bundle?

It does not work in the implementation that I have.