commit-classpath
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[commit-cp] [bugs #10539] java.beans.ExplicitBeanInfo bad array index


From: Matthew Chadwick
Subject: [commit-cp] [bugs #10539] java.beans.ExplicitBeanInfo bad array index
Date: Thu, 30 Sep 2004 12:31:27 -0400
User-agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)

This mail is an automated notification from the bugs tracker
 of the project: classpath.




/**************************************************************************/
[bugs #10539] Full Item Snapshot:

URL: <http://savannah.gnu.org/bugs/?func=detailitem&item_id=10539>
Project: classpath
Submitted by: Matthew Chadwick
On: Thu 09/30/2004 at 16:24

Category:  None
Severity:  5 - Average
Resolution:  None
Privacy:  Public
Assigned to:  None
Status:  Open
Platform Version:  Windows XP


Summary:  java.beans.ExplicitBeanInfo bad array index

Original Submission:  The getIcon() method of ExplicitBeanInfo indexes its 
icons array using the icon type values.  The icon types (defined in BeanInfo) 
range from 1 to 4, not from 0 to 3.  Either the wrong icon is retrieved, or in 
the case of 4, an ArrayIndexOutOfBoundsException is thrown.

Test Snippet:
public void testShouldNotHaveIcon() throws Exception
{
    BeanInfo simpleBeanInfo = Introspector.getBeanInfo(Object.class);
    assertEquals(null, 
simpleBeanInfo.getIcon(java.beans.BeanInfo.ICON_MONO_32x32));
}

Original:
public java.awt.Image getIcon(int iconType) {
    return icons != null ? icons[iconType] : null;
}

Recommended Fix:
public java.awt.Image getIcon(int iconType) {
    return icons != null ? icons[iconType-1] : null;
}












For detailed info, follow this link:
<http://savannah.gnu.org/bugs/?func=detailitem&item_id=10539>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/







reply via email to

[Prev in Thread] Current Thread [Next in Thread]