-
Enhancement
-
Resolution: Duplicate
-
P4
-
None
-
1.1.7
-
generic
-
generic
Name: krT82822 Date: 05/05/99
We are developing a strategy where classes has there own proterties-files. But the language-support was not as we expected. The problem was related to a problem in the findBundle method in ResourceBundle. We got 2 different properties-files, named packagename.DataManager_no.properties and packagename.DataManager.properties. The Class that use this properties is named packagename.Datamanager.Class. The problem occurs when a property is not in the DataManager_no.properties-file but in the DataManager.properties file. This because the findbundle method tries to load the DataManager.class file without casting it to a ResourceBundle file, and because of this the property-file with the same name as the class won't be loaded. This is a feature that we don't see is right. It should be possible to have both a class and a properties file in the same package with the same name.
public static void main(String args[]) {
try {
DataManager test = new DataManager();
ResourceBundle myResources = ResourceBundle.getBundle(test.getClass().getName());
OSSSystem.out.println( myResources.getString("FEIL19")); // works cause the property is in the DataManager_no.properties file.
OSSSystem.out.println( myResources.getString("FEIL99")); // will not work because the property is in the DataManager.properties file.
}
catch (Exception ex) {
OSSSystem.out.println(ex.toString());
}
}
(Review ID: 57475)
======================================================================
- duplicates
-
JDK-4083270 ResourceBundle.getBundle() does not check for subclass of ResourceBundle
-
- Resolved
-