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.
Build: NetBeans IDE Dev (Build 091120-1fba373ef266) VM: Java HotSpot(TM) Client VM, 14.0-b16, Java(TM) SE Runtime Environment, 1.6.0_14-b08 OS: SunOS, 5.10, x86 User Comments: GUEST: I'm using the Motif Look And Feel. Stacktrace: java.lang.NullPointerException at org.netbeans.swing.dirchooser.DirectoryChooserUI$IconIndenter.getIconWidth(DirectoryChooserUI.java:1709) at javax.swing.SwingUtilities.layoutCompoundLabelImpl(SwingUtilities.java:946) at javax.swing.SwingUtilities.layoutCompoundLabel(SwingUtilities.java:873) at javax.swing.plaf.basic.BasicLabelUI.layoutCL(BasicLabelUI.java:72) at javax.swing.plaf.basic.BasicLabelUI.getPreferredSize(BasicLabelUI.java:235) at javax.swing.JComponent.getPreferredSize(JComponent.java:1634)
Created attachment 91411 [details] stacktrace
cannot open project
A complete mystery to me. There used to be this bug, but was fixed in 152315. Currently line 1709 reads: return icon != null ? icon.getIconWidth() + depth*space : null; where depth and space are initialized. It's impossible to have NPE here, so either build was built from different sources or I don't know... Btw, Alexander Simon, when you just minimize exception window, you should be able to continue and open project, why exactly are you not able to open project?
I close exception window and open project dialog is not appeared. When I opening project again the exception window is appeared again....
Do you have some older builds to try? Didn't you make some manual changes like copying modules from 6.5 release or anything else that could touch the integrity of the build? I don't have other explanation then that there is different code running in your build then it's in repository sources...
By the way the code: private class IconIndenter implements Icon { Icon icon = null; public int getIconHeight() { return icon != null ? icon.getIconHeight() : null; } } is not right. Should be: Icon anIcon = icon; return anIcon != null ? anIcon.getIconHeight() : null; I checked bug on two computers.
And why you returns null instead 0?
so right code is: Icon anIcon = icon; return anIcon != null ? anIcon.getIconHeight() : 0;
*** Bug 152315 has been marked as a duplicate of this bug. ***
returning null is probably just a typo, fortunately does no harm AFAIK. Thanks for code review, you mean that icon variable will change from other thread to null after icon != null condition was passed? Yes, that would explain NPE. I'll integrate your suggestion on Monday, thanks.
Returning null DOES harm method. It is equivalent of unboxing: ((Integer)null).intValue(); It is a NPE.
fixed in core-main 36f1b0df6e29 QE, pls verify the fix, thanks
verified
The fix is correct.
fixed in release68 clone 91f865ccc985
Integrated into 'main-golden', will be available in build *200911241400* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main/rev/36f1b0df6e29 User: S. Aubrecht <saubrecht@netbeans.org> Log: #177280 - NPE