]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ResourceBundle.java (tryBundle): Use Class.isAssignableFrom rather than catching...
authorTom Tromey <tromey@redhat.com>
Mon, 25 Oct 2004 17:09:46 +0000 (17:09 +0000)
committerTom Tromey <tromey@gcc.gnu.org>
Mon, 25 Oct 2004 17:09:46 +0000 (17:09 +0000)
* java/util/ResourceBundle.java (tryBundle): Use
Class.isAssignableFrom rather than catching ClassCastException.

From-SVN: r89542

libjava/ChangeLog
libjava/java/util/ResourceBundle.java

index f79c8f89396dd2f22ac01774691fe42222614396..4dee1255019d153815a26b76376f3a2e6f3e2345 100644 (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
index 3299c6ff82507bf0d2a33080ba04b6120cb93c6d..a60471dcab5c3ae68d32f38d7048da7041f79c82 100644 (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)
       {