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 24781 - [Looks API] Children.setKeys called with null argument
Summary: [Looks API] Children.setKeys called with null argument
Status: VERIFIED FIXED
Alias: None
Product: contrib
Classification: Unclassified
Component: Looks (show other bugs)
Version: 3.x
Hardware: PC Linux
: P4 blocker (vote)
Assignee: Petr Hrebejk
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-06-14 15:47 UTC by _ hkrug
Modified: 2008-11-18 11:32 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description _ hkrug 2002-06-14 15:47:35 UTC
java.lang.NullPointerException
        at
org.openide.nodes.Children$Keys.setKeys(Children.java:1712)
        at
org.netbeans.api.looks.LookProperties$Ch.update(LookProperties.java:350)

You probably forgot that
Look.availableLooks(Look.NodeSubstitute) is
allowed to return null.

The code at LookProperties.java:350 is:

            if (active) {
                // refresh
                if (l != null && n != null) {
                    setKeys
(Collections.EMPTY_LIST);
                    setKeys (l.availableLooks
(n.getSubstitute ()));
                } else {
                    setKeys
(Collections.EMPTY_LIST);
                }
            }

It should be:

            if (active) {
                // refresh
                Look[] available;
                if (l != null && n != null &&
(available=l.availableLooks (n.getSubstitute ())
!= null ) {
                    setKeys
(Collections.EMPTY_LIST);
                    setKeys (available);
                } else {
                    setKeys
(Collections.EMPTY_LIST);
                }
            }


Please correct this bug here and at possible other
places or modify the API doc of
Look.availableLooks(..) !
Comment 1 _ hkrug 2002-06-14 18:22:51 UTC
I add a related bug to this issue instead of creating a new issue:

DefaultLookNode.drag(Look.NodeSubstitute) claims be behave neutrally
be returning null. Unfortunately this is not neutral behaviour but
seems to be a bug. DefaultLookNode.drag(..) should better throw an
IOException.

The reason is that Node.drag() requires either to return a
Transferable or to throw an exception.

The current implementation results in a NullPointerException whenever
a drag is started on a Look derived from DefaultLook not overriding
drag(..).

Probably similar methods of DefaultLook should also be reviewed  ?
Comment 2 Petr Hrebejk 2002-06-24 11:11:59 UTC
Moving Looks issues to dev 4.0
Comment 3 Marian Mirilovic 2003-01-29 12:54:37 UTC
added keyword PROJECTS, because we need to distinguish 
issues against NB4.0 and S1Sx.y
Comment 4 Petr Hrebejk 2003-05-06 15:11:37 UTC
Neither LookProperties or Look.availableLooks exist any more.
Thus marking as fixed.
Comment 5 Marian Mirilovic 2005-07-13 13:25:26 UTC
closed