Bug 24781 - [Looks API] Children.setKeys called with null argument
[Looks API] Children.setKeys called with null argument
Status: VERIFIED FIXED
Product: contrib
Classification: Unclassified
Component: Looks
3.x
PC Linux
: P4 (vote)
: 3.x
Assigned To: Petr Hrebejk
issues@contrib
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2002-06-14 15:47 UTC by _ hkrug
Modified: 2008-11-18 11:32 UTC (History)
0 users

See Also:
Issue Type: DEFECT
:


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


By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo