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:
Tom Tromey 2004-10-25 17:09:46 +00:00 committed by Tom Tromey
parent 6fc058da98
commit 4cd26879f7
2 changed files with 13 additions and 2 deletions

View File

@ -1,3 +1,8 @@
2004-10-25 Tom Tromey <tromey@redhat.com>
* java/util/ResourceBundle.java (tryBundle): Use
Class.isAssignableFrom rather than catching ClassCastException.
2004-10-25 Tom Tromey <tromey@redhat.com>
* gnu/java/text/WordBreakIterator.java (WordBreakIterator): Don't

View File

@ -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)
{