Are there any caveats regarding ResourceBundle names?

Joe Sam Shirah

The primary one is do not name a ResourcePropertyBundle ( less the ".properties" extension ) the same as the application or any other class. The only exception would be for a ListResourceBundle intended to override a properties file. This is pointed out in the API documentation for ResourcePropertyBundle:

If a real class and a properties file with a particular name both exist, the class wins; the properties file will only be used if there is no class with the desired name.

To make matters worse, this is inconsistently implemented among VMs. To lessen the chances of unexpected results, use a naming convention for ResourceBundles that is different from your standard class names, like MyApp_rb.

Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

About | Sitemap | Contact