Discussion:
Loading resource bundles across module boundaries
Nicolai Parlog
2018-02-11 15:31:21 UTC
Permalink
Hi!
* Code in a named module that calls getBundle(String, Locale)
will locate resource bundles in the caller's module (caller module).
* If resource bundles are deployed in named modules separate from the
caller module, those resource bundles need to be loaded from service
providers of ResourceBundleProvider.
I interpreted this to mean that, without registering services, named
modules can only load bundles from themselves. But in my experiments I
could also load resource bundles from other modules as long as the
package containing them was open.

Did I make a mistake? Did I misinterpret the Javadoc? Is that behavior
buggy?

so long ... Nicolai


[1] https://docs.oracle.com/javase/9/docs/api/java/util/ResourceBundle.html
--
PGP Key:
http://keys.gnupg.net/pks/lookup?op=vindex&search=0xCA3BAD2E9CCCD509

Web:
http://codefx.org
a blog about software development
https://www.sitepoint.com/java
high-quality Java/JVM content
http://do-foss.de
Free and Open Source Software for the City of Dortmund

Twitter:
https://twitter.com/nipafx
Alan Bateman
2018-02-11 20:48:38 UTC
Permalink
Post by Nicolai Parlog
I interpreted this to mean that, without registering services, named
modules can only load bundles from themselves. But in my experiments I
could also load resource bundles from other modules as long as the
package containing them was open.
Did I make a mistake? Did I misinterpret the Javadoc? Is that behavior
buggy?
The behavior is correct but isn't clearly covered in the Java SE 9
javadoc. Mandy has improved the javadoc for Java SE 10 [1] so it's much
clearer and covers all the scenarios.

-Alan

[1]
https://download.java.net/java/jdk10/docs/api/java/util/ResourceBundle.html
Nicolai Parlog
2018-02-12 14:30:16 UTC
Permalink
No matter what I do, there's always one document I didn't look at. :/

As usual, thank you very much!
Post by Alan Bateman
Post by Nicolai Parlog
I interpreted this to mean that, without registering services, named
modules can only load bundles from themselves. But in my experiments I
could also load resource bundles from other modules as long as the
package containing them was open.
Did I make a mistake? Did I misinterpret the Javadoc? Is that behavior
buggy?
The behavior is correct but isn't clearly covered in the Java SE 9
javadoc. Mandy has improved the javadoc for Java SE 10 [1] so it's much
clearer and covers all the scenarios.
-Alan
[1]
https://download.java.net/java/jdk10/docs/api/java/util/ResourceBundle.html
--
PGP Key:
http://keys.gnupg.net/pks/lookup?op=vindex&search=0xCA3BAD2E9CCCD509

Web:
http://codefx.org
a blog about software development
https://www.sitepoint.com/java
high-quality Java/JVM content
http://do-foss.de
Free and Open Source Software for the City of Dortmund

Twitter:
https://twitter.com/nipafx
Loading...