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 170897 - NPE with TabbedContainer and ComponentConverter
Summary: NPE with TabbedContainer and ComponentConverter
Status: VERIFIED FIXED
Alias: None
Product: platform
Classification: Unclassified
Component: Window System (show other bugs)
Version: 6.x
Hardware: PC Windows XP
: P2 blocker (vote)
Assignee: Stanislav Aubrecht
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-08-25 19:18 UTC by mklaehn
Modified: 2009-09-04 03:52 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
stacktrace of NPE in BasicScrollingTabDisplayerUI.getMinimumSize (4.09 KB, text/plain)
2009-08-25 19:18 UTC, mklaehn
Details

Note You need to log in before you can comment on or make changes to this bug.
Description mklaehn 2009-08-25 19:18:06 UTC
we created a TabbedContainer that uses the type editor.
within that TabbedContainer we set a ComponentConverter.
the ComponentConverter converts a business object of our into a Component that displays the data of the business object.

everything works fine until we tried to change the size of the TopComponent that contained the TabbedContainer.

java.lang.NullPointerException
	at org.netbeans.swing.tabcontrol.plaf.BasicScrollingTabDisplayerUI.getMinimumSize(BasicScrollingTabDisplayerUI.java:399)
	at org.netbeans.swing.tabcontrol.TabDisplayer.getMinimumSize(TabDisplayer.java:397)
	at java.awt.BorderLayout.minimumLayoutSize(BorderLayout.java:651)
	at java.awt.Container.minimumSize(Container.java:1651)
	at java.awt.Container.getMinimumSize(Container.java:1636)
...

looking into the sources the exception indicated we learned that the minimumSize of a TabData is determined by getting
the minimumSize of tabData.getComponent().

it is our understanding that if a ComponentConverter is used the restriction to supply a Component to the property
userObject of TabData is lifted to make lazy instatiation of that instances component possible. The problem in that is
that TabData does not know anything about that ComponentConverter.

said exception indicated one place where that is problematic. Determining the minimumSize of
BasicScrollingTabDisplayerUI is done by returning TabData.getComponent().getMinimumSize() which with the use of a
ComponentConverter is not required to be an instance of Component and as such returns null.
Comment 1 mklaehn 2009-08-25 19:18:57 UTC
Created attachment 86649 [details]
stacktrace of NPE in BasicScrollingTabDisplayerUI.getMinimumSize
Comment 2 Stanislav Aubrecht 2009-08-26 10:38:03 UTC
not a P1 issue, pls see http://qa.netbeans.org/bugzilla/bug_priority_guidelines.html

a hot fix is to use some default minimum size when TabData.getComponent(), anything else will need an API change i'm afraid
Comment 3 Stanislav Aubrecht 2009-09-01 07:17:18 UTC
fixed

core-main 46f3b22dc4a4
Comment 4 mklaehn 2009-09-03 10:48:55 UTC
while i have to agree the the reason for the NPE is fixed any required minimum sizes of the converted userObject of a
TabData is still ignored. that however is a matter for a different issue (see
http://www.netbeans.org/issues/show_bug.cgi?id=171385).
Comment 5 Quality Engineering 2009-09-04 03:52:16 UTC
Integrated into 'main-golden', will be available in build *200909032054* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/46f3b22dc4a4
User: S. Aubrecht <saubrecht@netbeans.org>
Log: #170897 - NPE