Bug 29770 - NPE in java.beans.SimpleBeanInfo.loadImage(String)
Summary: NPE in java.beans.SimpleBeanInfo.loadImage(String)
Status: RESOLVED FIXED
Alias: None
Product: classpath
Classification: Unclassified
Component: classpath (show other bugs)
Version: 0.92
: P3 normal
Target Milestone: 0.93
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-11-08 20:35 UTC by Horcrux7
Modified: 2006-11-09 12:56 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2006-11-09 12:40:26


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Horcrux7 2006-11-08 20:35:18 UTC
The method java.beans.SimpleBeanInfo.loadImage(String) throw a NPE if the image resource was not found. It should look more like:

public Image loadImage(String location) {
  URL url = getClass().getResource(location);
  if(url == null){
    return null;
  }
  return Toolkit.getDefaultToolkit().getImage(url);
}
Comment 1 david.gilbert 2006-11-09 12:40:26 UTC
Thanks for the report.  I've added a Mauve test that covers this bug.  Your suggested fix is good, although it needs a check for a null 'location' argument as well.  I'll commit something to CVS shortly.
Comment 2 david.gilbert 2006-11-09 12:56:25 UTC
The fix is committed to CVS:

2006-11-09  David Gilbert  <david.gilbert@object-refinery.com>

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