This patch (committed) fixes a bug in the loadImage() method:

2006-11-09  David Gilbert  <[EMAIL PROTECTED]>

   Fixes bug #29770
   * java/beans/SimpleBeanInfo.java
   (loadImage): Check for nulls.

I've already committed Mauve tests for this.

Regards,

Dave
Index: java/beans/SimpleBeanInfo.java
===================================================================
RCS file: /sources/classpath/classpath/java/beans/SimpleBeanInfo.java,v
retrieving revision 1.8
diff -u -r1.8 SimpleBeanInfo.java
--- java/beans/SimpleBeanInfo.java      2 Jul 2005 20:32:37 -0000       1.8
+++ java/beans/SimpleBeanInfo.java      9 Nov 2006 12:37:12 -0000
@@ -1,5 +1,5 @@
 /* java.beans.SimpleBeanInfo
-   Copyright (C) 1998 Free Software Foundation, Inc.
+   Copyright (C) 1998, 2006, Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -40,6 +40,7 @@
 
 import java.awt.Image;
 import java.awt.Toolkit;
+import java.net.URL;
 
 /**
  ** SimpleBeanInfo is a class you may extend to more easily
@@ -130,10 +131,16 @@
         ** and its BeanInfo are both loaded by the same
         ** ClassLoader, generally a reasonable assumption.
         ** @param location the URL relative
-        ** @return the Image in question.
+        ** @return the Image in question (possibly <code>null</code>).
         **/
-       public Image loadImage(String location) {
-               return 
Toolkit.getDefaultToolkit().getImage(getClass().getResource(location));
+       public Image loadImage(String location) 
+    {
+      if (location == null)
+        return null;
+      URL url = getClass().getResource(location);
+      if (url == null)
+        return null;
+      return Toolkit.getDefaultToolkit().getImage(url);
        }
 }
 

Reply via email to