summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Gilbert <david.gilbert@object-refinery.com>2006-11-09 12:52:28 +0000
committerDavid Gilbert <david.gilbert@object-refinery.com>2006-11-09 12:52:28 +0000
commite38b7787ddcc8d6fed61f7bc7a7f95bcbfe20ab8 (patch)
treed985a6cc0999580e2710dba56c81565948ff9fad
parentfcd003dbf74f3510d39f661a90d6b6e9131dda5d (diff)
downloadclasspath-e38b7787ddcc8d6fed61f7bc7a7f95bcbfe20ab8.tar.gz
2006-11-09 David Gilbert <david.gilbert@object-refinery.com>
Fixes bug #29770 * java/beans/SimpleBeanInfo.java (loadImage): Check for nulls.
-rw-r--r--ChangeLog6
-rw-r--r--java/beans/SimpleBeanInfo.java15
2 files changed, 17 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 55b67687a..964c039b8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2006-11-09 David Gilbert <david.gilbert@object-refinery.com>
+
+ Fixes bug #29770
+ * java/beans/SimpleBeanInfo.java
+ (loadImage): Check for nulls.
+
2006-11-09 Robert Schuster <robertschuster@fsfe.org>
* native/jni/java-nio/gnu_java_nio_VMChannel.c:
diff --git a/java/beans/SimpleBeanInfo.java b/java/beans/SimpleBeanInfo.java
index cfb960484..56b1f7aa7 100644
--- a/java/beans/SimpleBeanInfo.java
+++ b/java/beans/SimpleBeanInfo.java
@@ -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 @@ package java.beans;
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 @@ public class SimpleBeanInfo implements BeanInfo {
** 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);
}
}