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 17728 - "IAE: Property which value is not an array component"
Summary: "IAE: Property which value is not an array component"
Status: CLOSED FIXED
Alias: None
Product: platform
Classification: Unclassified
Component: Explorer (show other bugs)
Version: 3.x
Hardware: PC Linux
: P4 blocker (vote)
Assignee: David Strupl
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2001-11-15 21:39 UTC by Jesse Glick
Modified: 2008-12-22 20:45 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Stack trace (1.75 KB, text/plain)
2001-11-15 21:40 UTC, Jesse Glick
Details
Exception thrown when customizing IDESettingsPanel (1.64 KB, text/plain)
2001-12-12 22:03 UTC, Jesse Glick
Details
Test class (internal exec) (1.37 KB, text/x-java)
2001-12-13 14:11 UTC, Jesse Glick
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jesse Glick 2001-11-15 21:39:29 UTC
[dev nov 15] I opened the bean browser on the MemoryView pseudo-action
(from Toolbars | Memory), browsed to instance of MemoryViewAction,
down to its toolbar presenter, and immediately this exception appeared
twice. (I was not attempting to set any value, just selected the
node.)
Comment 1 Jesse Glick 2001-11-15 21:40:27 UTC
Created attachment 3437 [details]
Stack trace
Comment 2 David Strupl 2001-11-16 10:03:53 UTC
Hello,
I am marking this as invalid for now - please reopen after explaining.
This is what I did:
1. clean build from trunk with apisupport module
2. Tools --> Options --> IDE Configuration --> Look and Feel -->
Toolbars --> Memory
--- no MemoryViewAction, just MemoryMeter
3. tried MemoryMeter --> Tools --> Bean Browse --> Bean Browse Node
4. Found toolbar presenter and displayed properties -- no problem

I need to know the node/bean and the property in order to find whether
the property (beaninfo) is ok or whether the problem is on
PropertyPanel's side.

Thanks for additional info.
Comment 3 Jesse Glick 2001-11-16 11:57:32 UTC
That's my point, I guess--I have no idea what property is at fault.
(It is quite possible something in apisupport is really to blame, but
what?) The exception message does not include any useful details as to
what bean is involved, what property it is working on, what the type
of the property is, etc. It's not even clear if the stack trace here
is at all meaningful, or if the real error occurred before and this is
just a SwingUtilities.invokeLater.
Comment 4 David Strupl 2001-11-16 12:03:06 UTC
The property name is there ("component"). The node is the node
selected in the moment the exception poped up in the exception dialog
(if it was reported by the dialog).
Comment 5 Jesse Glick 2001-11-17 08:31:45 UTC
I see. Confusing exception message (I thought "array component" was
one phrase; no?). I will try to track it down in apisupport and maybe
improve the exception message to be clearer as well.
Comment 6 Jan Chalupa 2001-11-27 10:45:13 UTC
Target milestone -> 3.3.1.
Comment 7 Jesse Glick 2001-12-12 22:01:48 UTC
Found a different case, no apisupport. Mount release33 core/src/ and
compile it. Select org/netbeans/core/ui/IDESettingsPanel.java and
choose Customize Bean. Dialog appears with the property sheet and this
exception is thrown immediately (though properties still seem to
appear OK). In this case there are r/o props Component getComponent(),
Component[] getComponents(), int getComponentCount() visible.
Comment 8 Jesse Glick 2001-12-12 22:03:57 UTC
Created attachment 3801 [details]
Exception thrown when customizing IDESettingsPanel
Comment 9 David Strupl 2001-12-13 10:41:04 UTC
The problem is that Introspector returns IndexedPropertyDescriptor
for property called component. Try this (or similar)

java.beans.BeanInfo y =
java.beans.Introspector.getBeanInfo(org.netbeans.core.ui.IDESettingsPanel.class);
java.beans.PropertyDescriptor[] p = y.getPropertyDescriptors();
for (int i = 0; i < p.length; i++) {
    if (p[i] instanceof java.beans.IndexedPropertyDescriptor) {
        System.out.println(p[i].getReadMethod() + " " +  
p[i].getWriteMethod());
    }
}

to find out what the introspector thinks about the bean.
What should I do? I expect that if something has
IndexedPropertyDescriptor then its getter returns an array. If this is
not true - the exception is shown.

Should I make it notified as informational? I don't have anything
better. Any suggestions welcomed.
Comment 10 Jesse Glick 2001-12-13 14:11:44 UTC
Created attachment 3814 [details]
Test class (internal exec)
Comment 11 Jesse Glick 2001-12-13 14:17:23 UTC
You're right, the problem is with the 'component' property.

public class Container {
    public Component getComponentAt(int index);
}
public class IDESettingsPanel extends ... Container {
    public Component getComponent();
}

Introspector creates an indexed property here. It *correctly* sets the
indexed property type and getter from Container. However it *also*
adds a bogus property type Container and getter from IDESettingsPanel,
accessible from the PropDesc methods. Logically these should be
separate properties since they have unrelated accessors; of course
only one property with a given name can exist on a bean so IMHO
Introspector should discard the info from Container and make a plain
PropDesc (not IndexedPropDesc) 'component' based on IDESP.

Do you want to file it in Bugtraq or should I?

Possible workaround: discard any IndexedPropertyDescriptor's from a
model whose plain (not indexed) type is not in fact an array type;
don't wait for them to be used in a getter, just throw them out. Or
perhaps this workaround could be placed on BeanNode instead of in the
property sheet, since BeanNode is responsible for calling the
introspection to begin with and should handle its ill effects.
Comment 12 David Strupl 2001-12-13 17:40:34 UTC
Please file it for the JDK team and I will fix BeanNode tomorow.
Comment 13 David Strupl 2001-12-14 09:05:31 UTC
Fixed in BeanNode 1.46.32.1 (release33 branch).
Comment 14 Jesse Glick 2001-12-14 14:20:58 UTC
Filed on JDC, will attach link when it is made public.
Comment 15 Quality Engineering 2003-07-01 15:52:51 UTC
Resolved for 3.4.x or earlier, no new info since then -> verified
Comment 16 Quality Engineering 2003-07-01 16:13:15 UTC
Resolved for 3.4.x or earlier, no new info since then -> closing.