ResourceBundle.java (tryBundle): Use Class.isAssignableFrom rather than catching ClassCastException.
* java/util/ResourceBundle.java (tryBundle): Use Class.isAssignableFrom rather than catching ClassCastException. From-SVN: r89542
This commit is contained in:
parent
6fc058da98
commit
4cd26879f7
2 changed files with 13 additions and 2 deletions
|
@ -473,12 +473,18 @@ public abstract class ResourceBundle
|
|||
rbClass = Class.forName(localizedName);
|
||||
else
|
||||
rbClass = classloader.loadClass(localizedName);
|
||||
bundle = (ResourceBundle) rbClass.newInstance();
|
||||
// Note that we do the check up front instead of catching
|
||||
// ClassCastException. The reason for this is that some crazy
|
||||
// programs (Eclipse) have classes that do not extend
|
||||
// ResourceBundle but that have the same name as a property
|
||||
// bundle; in fact Eclipse relies on ResourceBundle not
|
||||
// instantiating these classes.
|
||||
if (ResourceBundle.class.isAssignableFrom(rbClass))
|
||||
bundle = (ResourceBundle) rbClass.newInstance();
|
||||
}
|
||||
catch (IllegalAccessException ex) {}
|
||||
catch (InstantiationException ex) {}
|
||||
catch (ClassNotFoundException ex) {}
|
||||
catch (ClassCastException ex) {}
|
||||
|
||||
if (bundle == null)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue