This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 164371

Summary: [67cat] ImageUtilities behaviour inconsistent, please fix before 6.7
Product: platform Reporter: aldobrucale <aldobrucale>
Component: -- Other --Assignee: t_h <t_h>
Status: RESOLVED FIXED    
Severity: blocker CC: apireviews
Priority: P2 Keywords: API_REVIEW_FAST
Version: 6.x   
Hardware: PC   
OS: Linux   
Issue Type: DEFECT Exception Reporter:
Attachments: messages.log for the application

Description aldobrucale 2009-05-04 11:01:53 UTC
[ JDK VERSION : 1.6.* ]

I've tried to switch to the 6.7 beta version of the platform for my
platform-based application. At program startup I'm getting an
exception when org.openide.awt.DynaMenuModel gets loaded: the
BLANK_ICON static variable cannot be initialized because
org/openide/loaders/empty.gif is not in the classpath.
Comment 1 aldobrucale 2009-05-04 11:04:19 UTC
Created attachment 81457 [details]
messages.log for the application
Comment 2 Stanislav Aubrecht 2009-05-04 11:30:52 UTC
probably a duplicate, please evaluate, thanks.
Comment 3 Jaroslav Tulach 2009-05-04 12:31:09 UTC
Thanks for testing compatibility of the platform before final release.

Can you please put breakpoint or debug message to
org.openide.awt.AlwaysEnabledAction.extractCommonAttribute(AlwaysEnabledAction.java:156)
and find out which FileObject has the faulty attribute? Thanks.
Comment 4 aldobrucale 2009-05-04 15:07:10 UTC
It was a missing resource for my own TopComponent, specified as an "iconBase" attribute in layer.xml - I hadn't noticed
the missing icon: it used to fail silently in nb 6.5, now it throws an exception. Maybe a warning would be more appropriate?
Comment 5 Jaroslav Tulach 2009-05-05 20:28:14 UTC
Problem1: ImageUtilities.loadImage(String,boolean) does not say that it can return null. But it can. Please update 
javadoc.

Problem2: When one calls loadImageIcon(samepath, true) one gets NPE. Because loadImage returns null. The loadImageIcon 
shall and loadIcon, etc. shall declare that they can return null and return it instead of throwing NPE.

Enhancement3: image2Icon and icon2Image could also accept null as input argument. Needs change in code and in javadoc.
Comment 6 Jesse Glick 2009-05-05 20:59:48 UTC
Enhancement3 does not sound necessary.
Comment 7 t_h 2009-05-06 11:31:49 UTC
core-main #7bf1176987b0
Comment 8 Quality Engineering 2009-05-07 08:13:12 UTC
Integrated into 'main-golden', will be available in build *200905070201* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/7bf1176987b0
User: Tomas Holy <t_h@netbeans.org>
Log: #164371: ImageUtilities behaviour inconsistent