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 21285 - NPE when using BeanNode w/ IndexedPropertyDescriptor w/o non-indexed value type
Summary: NPE when using BeanNode w/ IndexedPropertyDescriptor w/o non-indexed value type
Status: CLOSED FIXED
Alias: None
Product: platform
Classification: Unclassified
Component: Nodes (show other bugs)
Version: 3.x
Hardware: PC Linux
: P2 blocker (vote)
Assignee: Petr Hrebejk
URL:
Keywords: API
: 22497 (view as bug list)
Depends on:
Blocks:
 
Reported: 2002-03-07 08:48 UTC by Jesse Glick
Modified: 2008-12-22 18:42 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Stack trace (1.29 KB, text/plain)
2002-03-07 08:49 UTC, Jesse Glick
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jesse Glick 2002-03-07 08:48:26 UTC
[dev mar 06] If a bean has a BeanInfo giving an
IndexedPropertyDescriptor giving only an indexed getter and no other
accessors, BeanNode.computeProperties creates an
IndexedPropertySupport for the property, where valueType==null. This
is illegal according to the IndexedPropertySupport Javadoc, which does
not mention that a null param is OK. (Actually it does not mention
that *any* null params are OK, which is probably a docs bug. All
params which might be null must be documented as such.)
IndexedPropertySupport passes the null valueType to
Node.IndexedProperty, which again is not documented to accept it.
Node.IndexedProperty passes the null to Node.Property, which is also
not documented to accept it (nor is getValueType documented to return
it). And Node.Property.hashCode (as well as other methods) assume that
it is not null.

For an example, see issue #21284, where a poorly written BeanInfo for
the Sun-style XML catalog resolver (Runtime | XML Entity Catalogs |
Resolver at file:/whatever) produces such an
IndexedPropertyDescriptor. If you select a range of such resolvers in
the Explorer, the property sheet tries to merge their properties, thus
using a hashtable, thus calling Node.Property.hashCode, thus causing
an NPE. P2 because not only is an exception thrown, but almost
anything you do in the IDE will continue to throw more NPEs until you
exit.
Comment 1 Jesse Glick 2002-03-07 08:49:08 UTC
Created attachment 4976 [details]
Stack trace
Comment 2 Petr Hrebejk 2002-03-08 13:17:56 UTC
Node.Propert and Node.IndexedProperty are rewritten to handle the
null values in valueType and elementTypeCorrectly.

For regression test please see:
openide/test/regr/srcorg/openide/nodes/BeanNodeBug21285.java
Comment 3 Jesse Glick 2002-03-08 14:26:34 UTC
OK. The Javadoc comments for several classes are still wrong, then.
Comment 4 _ ttran 2002-04-17 12:34:59 UTC
*** Issue 22497 has been marked as a duplicate of this issue. ***
Comment 5 pzajac 2002-10-21 12:57:35 UTC
verified
Comment 6 Marian Mirilovic 2003-03-17 12:38:08 UTC
Verified in Update patch 2 for S1S 4.1
Comment 7 Quality Engineering 2003-07-01 16:10:35 UTC
Resolved for 3.4.x or earlier, no new info since then -> closing.