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 32673 - Exceptions during startup on JDK 1.4.2-beta w/ Windows L&F
Summary: Exceptions during startup on JDK 1.4.2-beta w/ Windows L&F
Status: VERIFIED FIXED
Alias: None
Product: platform
Classification: Unclassified
Component: Window System (show other bugs)
Version: 3.x
Hardware: PC Windows 3.1/NT
: P1 blocker (vote)
Assignee: _ tboudreau
URL:
Keywords: JDK_SPECIFIC, L&F
: 32674 32688 32861 33066 (view as bug list)
Depends on:
Blocks:
 
Reported: 2003-04-07 11:40 UTC by Jan Chalupa
Modified: 2008-12-22 16:50 UTC (History)
5 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Exception stack-trace (11.86 KB, text/plain)
2003-04-07 11:41 UTC, Jan Chalupa
Details
Patch (4.96 KB, application/octet-stream)
2003-04-07 14:05 UTC, mslama
Details
Console output produced w/ patch. (26.27 KB, text/plain)
2003-04-07 14:26 UTC, Jan Chalupa
Details
Patch to use a BufferedImage in the case the returned icon is not ImageIcon (2.24 KB, patch)
2003-04-08 15:16 UTC, _ tboudreau
Details | Diff
Binary patch - Mariane, can you test? (2.81 KB, application/octet-stream)
2003-04-08 15:18 UTC, _ tboudreau
Details
NullPointerException (1.62 KB, text/plain)
2003-04-08 15:25 UTC, Marian Mirilovic
Details
Same patch, but with fail-fast NPE w/ better message (2.62 KB, patch)
2003-04-08 15:34 UTC, _ tboudreau
Details | Diff
Same as above, binary version (3.09 KB, application/octet-stream)
2003-04-08 15:35 UTC, _ tboudreau
Details
Patch including fallback to getIcon and fail-fast NPE (2.83 KB, patch)
2003-04-08 17:14 UTC, _ tboudreau
Details | Diff
Binary version w/ fallback to getIcon (3.09 KB, application/octet-stream)
2003-04-08 17:15 UTC, _ tboudreau
Details
Yet another binary patch, this one eliminating the UI class completely (5.43 KB, application/octet-stream)
2003-04-09 11:38 UTC, _ tboudreau
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jan Chalupa 2003-04-07 11:40:28 UTC
[release35-200304062350, Sun JDK 1.4.2-beta, MDI]

Just started with a clean userdir and got a bunch
of exceptions (full exception stack-trace will be
attached):

Annotation: Could not work with top component
reference
Windows/WindowManager/Editing/explorer/properties.wstcref
and update its mode, reason: Wrong settings format.
Annotation: Source:
Windows/Components/properties.settings
...
java.io.IOException: Wrong settings format.
	at
org.netbeans.modules.settings.convertors.XMLSettingsSupport$SettingsRecognizer.createFromMethod(XMLSettingsSupport.java:643)
...
==>
java.lang.reflect.InvocationTargetException
	at
sun.reflect.NativeMethodAccessorImpl.invoke0(Native
Method)
	at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:324)
	at 
org.netbeans.modules.settings.convertors.XMLSettingsSupport$SettingsRecognizer.createFromMethod(XMLSettingsSupport.java:640)
...
Caused by: java.lang.ClassCastException
	at
org.openide.awt.ToolbarButtonUI.installUI(ToolbarButtonUI.java:67)
	at javax.swing.JComponent.setUI(JComponent.java:449)
...
==>
java.lang.ClassCastException
	at
org.openide.awt.ToolbarButtonUI.installUI(ToolbarButtonUI.java:67)
	at javax.swing.JComponent.setUI(JComponent.java:449)
	at
org.openide.awt.ToolbarToggleButton.updateUI(ToolbarToggleButton.java:63)
...
Comment 1 Jan Chalupa 2003-04-07 11:41:54 UTC
Created attachment 9733 [details]
Exception stack-trace
Comment 2 mslama 2003-04-07 14:05:07 UTC
I will attach patch with logging. Add patch to lib/patches. Please
test it with command line switch -J-Dnetbeans.logger.console=true (in
NB 3.5). 
Comment 3 mslama 2003-04-07 14:05:36 UTC
Created attachment 9742 [details]
Patch
Comment 4 Jan Chalupa 2003-04-07 14:26:57 UTC
Created attachment 9743 [details]
Console output produced w/ patch.
Comment 5 Jan Chalupa 2003-04-07 14:27:51 UTC
Please see my previous attachment. Hope it's what you need.
Comment 6 mslama 2003-04-07 14:39:28 UTC
It looks like bug in our code namely ToolbarButtonUI:

We use:
ImageIcon icon = (ImageIcon)button.getDisabledIcon();

But AbstractButton returns Icon (interface implemented also by class
ImageIcon) but in this case javax.swing.plaf.IconUIResource is
returned by AbstractButton.

Assigning to openide/awt.
Comment 7 Marian Mirilovic 2003-04-08 09:52:57 UTC
Tim, is it possible to fix it for 3.5 release ? (not 3.5 Beta)
Without fixing this issue, IDE is useless on Windows with Win L&F.
Comment 8 Marian Mirilovic 2003-04-08 13:34:02 UTC
*** Issue 32674 has been marked as a duplicate of this issue. ***
Comment 9 _ tboudreau 2003-04-08 15:16:18 UTC
Created attachment 9769 [details]
Patch to use a BufferedImage in the case the returned icon is not ImageIcon
Comment 10 _ tboudreau 2003-04-08 15:18:26 UTC
Created attachment 9770 [details]
Binary patch - Mariane, can you test?
Comment 11 Marian Mirilovic 2003-04-08 15:24:09 UTC
I've tried your patch and NPE rises (see attached stack trace). :(
Comment 12 Marian Mirilovic 2003-04-08 15:25:17 UTC
Created attachment 9772 [details]
NullPointerException
Comment 13 _ tboudreau 2003-04-08 15:33:49 UTC
Looks like UIManager.getIcon() is returning null for this in addition.
The patch should be kept, since it is wrong for our code to assume
the Icon from UIManager will be an instance of ImageIcon.

I'll add another patch which tests for null and throws an NPE with
an intelligent enough message to try to figure out what icon 
UIManager returned null for.
Comment 14 _ tboudreau 2003-04-08 15:34:46 UTC
Created attachment 9773 [details]
Same patch, but with fail-fast NPE w/ better message
Comment 15 _ tboudreau 2003-04-08 15:35:28 UTC
Created attachment 9774 [details]
Same as above, binary version
Comment 16 _ tboudreau 2003-04-08 17:13:53 UTC
Marian found an open JDK bug - JButton.getDisabledIcon() returns 
null if getIcon() returns an instanceof Icon, not ImageIcon.  So
we get an NPE on Windows instead of a CCE.

Attaching yet another patch, that attempts to fall back to getIcon()
if getDisabledIcon() returns null.
Comment 17 _ tboudreau 2003-04-08 17:14:35 UTC
Created attachment 9780 [details]
Patch including fallback to getIcon and fail-fast NPE
Comment 18 _ tboudreau 2003-04-08 17:15:24 UTC
Created attachment 9781 [details]
Binary version w/ fallback to getIcon
Comment 19 Marian Mirilovic 2003-04-08 17:19:40 UTC
Just for note:
http://developer.java.sun.com/developer/bugParade/bugs/4820053.html
Comment 20 _ tboudreau 2003-04-09 09:47:57 UTC
Looks like the problem for the rest of the toolbars is that 
ToolbarButton does not call super.updateUI() when it 
overrides updateUI().

The whole ToolbarButton/ToolbarButtonUI thing is a mess.
ToolbarButtonUI contains code to create a "grayed out" 
icon (in a needlessly complex manner).

So does ToolbarButton.  I am mystified at what the point of
ToolbarButtonUI ever is or was.  Most of its history was
drowned by the reformatting before we open-sourced NetBeans.

As far as I can tell, ToolbarButtonUI can be safely deleted
in its entirety, and that will solve the problem on 1.4.2.

I'm removing the use of ToolbarButtonUI.  This will fix
the toolbar buttons.  If we want to port this fix to
NetBeans 3.5, we will need test it on 1.3 and see if
ToolbarButtonUI serves some purpose there - in which 
case we can test for 1.3 and use it.  I'm leaving
ToolbarButtonUI in the trunk for now, for that reason.
Comment 21 Marian Mirilovic 2003-04-09 10:23:16 UTC
Tim, can you attach patch here :) Thanks ...
Comment 22 _ tboudreau 2003-04-09 11:38:14 UTC
Created attachment 9798 [details]
Yet another binary patch, this one eliminating the UI class completely
Comment 23 Marian Mirilovic 2003-04-09 13:25:22 UTC
Waw, Tim great, it seems like it is fixed now, issue 32688 is fixed
too :). 

I am going to test it with another L&Fs and different JDKs. 
Comment 24 David Simonek 2003-04-10 15:13:20 UTC
I reviewed the changes and I approve, fix is safe. Fix basically
removes the code which caused the bug.
Code in ToolbarButtonUI was probably workaround for missing feature of
win LF on jdk 1.2 or older, now is obsolete.
Comment 25 _ ttran 2003-04-10 16:29:32 UTC
approved for 3.5
Comment 26 Marian Mirilovic 2003-04-10 16:53:30 UTC
I forgot - patch verified :)
Comment 27 Marian Mirilovic 2003-04-11 16:23:00 UTC
*** Issue 32688 has been marked as a duplicate of this issue. ***
Comment 28 Marian Mirilovic 2003-04-11 16:23:38 UTC
*** Issue 32688 has been marked as a duplicate of this issue. ***
Comment 29 Marian Mirilovic 2003-04-11 16:55:37 UTC
verified in [nb3.5](200304102350)
Comment 30 Tomas Pavek 2003-04-14 12:52:14 UTC
*** Issue 32861 has been marked as a duplicate of this issue. ***
Comment 31 _ tboudreau 2003-04-18 21:02:15 UTC
*** Issue 33066 has been marked as a duplicate of this issue. ***