The usage of "displaySections[0]" comes from struts itself when it
disassembles the request to determine which HTML form field values map to
what Bean properties.  The identification of PropertyDescriptor vs
IndexedPropertyDescriptor is solely the realm of
BeanInfo.getPropertyDescriptor.  You can see this at work in PropertyUtils
method public static PropertyDescriptor[] getPropertyDescriptors(Class
beanClass).

So no matter what struts thinks about names, it's really all up to Java's
reflection capabilities.  This is why I feel that we've got a potential JDK
1.4.1 issue here.






> -----Original Message-----
> From: Karr, David [mailto:david.karr@;attws.com]
> Sent: Thursday, November 14, 2002 2:40 PM
> To: Struts Users Mailing List
> Subject: RE: IndexOutOfBounds error, Struts 1.1b2, J2SDK 1.4.1
>
>
> So you're telling me that in both test cases, the "name" value is
> "displaySections", and in the "before" test case, you get back an
> IndexedPropertyDescriptor, and in the "after" test case, you get
> back a PropertyDescriptor?  I'm not that familiar with this code,
> but I don't see how you could get back an
> IndexedPropertyDescriptor, no matter what JDK version you're
> using.  If your name value was "displaySections[<number>]" then
> you should get an IndexedPropertyDescriptor, otherwise a
> PropertyDescriptor.
>
> > -----Original Message-----
> > From: Jim Krygowski [mailto:james.krygowski@;shaws.com]
> >
> > As you suggested I delved into getDisplaySections.  I found
> > that my "name"
> > value, displaySections, was inappropriately identified as an
> > PropertyDescriptor even though it is defined as an ArrayList
> > with get and
> > set methods that handle the ArrayList datatype.  The funny
> > thing is that the
> > propertyType attribute of the PropertyDescriptor is ArrayList for the
> > displaySections node.
> >
> > Given this new info, what do you think is going on here?
> >
> >
> > > -----Original Message-----
> > > From: Karr, David [mailto:david.karr@;attws.com]
> > > Sent: Thursday, November 14, 2002 2:03 PM
> > > To: Struts Users Mailing List
> > > Subject: RE: IndexOutOfBounds error, Struts 1.1b2, J2SDK 1.4.1
> > >
> > >
> > > Step through the "getPropertyDescriptor()" method, which is
> > > called just before that check.  That's what makes the decision on
> > > what type to return.  What is the value of "name"?
> > >
> > > > -----Original Message-----
> > > > From: Jim Krygowski [mailto:james.krygowski@;shaws.com]
> > > > Sent: Thursday, November 14, 2002 10:43 AM
> > > > To: Struts Users Mailing List
> > > > Subject: RE: IndexOutOfBounds error, Struts 1.1b2, J2SDK 1.4.1
> > > >
> > > >
> > > > Been doing some research since my last post.  Here's the
> > setup, same
> > > > application code, same struts jars, same app server switching
> > > > between JDK
> > > > 1.3.1 and 1.4.1:
> > > >
> > > > When processing a submit, in the PropertyUtils the following
> > > > check is made
> > > > in the getIndexedProperty method on or around line 468:
> > > >
> > > >  if (descriptor instanceof IndexedPropertyDescriptor) {
> > > >
> > > > With JDK 1.3.1 running descriptor is indeed an
> > > > IndexedPropertyDescriptor,
> > > > but with JDK 1.4.1 I get a java.beans.PropertyDescriptor, so
> > > > the code passes
> > > > by the block that should handle the property I've passed an
> > > > onto a block of
> > > > code that results in the IndexOutOfBoundsException.
> > > >
> > > > This seems like a 1.4.1 induced bug.  Should I log it in
> > > > Bugzilla?  Has
> > > > anyone else seen this bug?
> > > >
> > > >
> > > >
> > > > > -----Original Message-----
> > > > > From: Jim Krygowski [mailto:james.krygowski@;shaws.com]
> > > > > Sent: Thursday, November 14, 2002 11:32 AM
> > > > > To: Struts Users Mailing List
> > > > > Subject: IndexOutOfBounds error, Struts 1.1b2, J2SDK 1.4.1
> > > > >
> > > > >
> > > > > Hi all-
> > > > >
> > > > > we have an application originally written to struts 1.1b2 and
> > > > > J2SDK 1.3.1_03
> > > > > that was working fine.  Recently, we've been given the signal to
> > > > > upgrade to
> > > > > J2SDK 1.4.1.  Fine, but now we're finding that our form
> > > > posts are failing
> > > > > with IndexOutOfBoundsException.  I've traced through the Struts
> > > > > source with
> > > > > a debugger and found the problem in this block of
> > > > PropertyUtils code:
> > > > >
> > > > >         // Call the property getter and return the value
> > > > >         Object value = readMethod.invoke(bean, new Object[0]);
> > > > >         if (!value.getClass().isArray()) {
> > > > >             if (!(value instanceof java.util.List)) {
> > > > >                 throw new
> > > > IllegalArgumentException("Property '" + name
> > > > >                         + "' is not indexed");
> > > > >             } else {
> > > > >                 //get the List's value
> > > > >                 return ((java.util.List) value).get(index);
> > > > >             }
> > > > >         } else {
> > > > >             //get the array's value
> > > > >             return (Array.get(value, index));
> > > > >         }
> > > > >
> > > > > It seems to me that the line:
> > > > >
> > > > > return ((java.util.List) value).get(index)
> > > > >
> > > > > fails because the form bean just got created by Struts and
> > > > hasn't been
> > > > > populated yet.  However, it works just fine when I
> > switch back to
> > > > > JDK 1.3.1.
> > > > >
> > > > > Anyone got any suggestions as to what might be happening?
> > > > >
> > > > >
> > > > > --
> > > > > To unsubscribe, e-mail:
> > > > <mailto:struts-user-unsubscribe@;jakarta.apache.org>
> > > > For additional commands, e-mail:
> > > > <mailto:struts-user-help@;jakarta.apache.org>
> > > >
> > > >
> > > >
> > > > --
> > > > To unsubscribe, e-mail:
> > > <mailto:struts-user-unsubscribe@;jakarta.apache.org>
> > > For additional commands, e-mail:
> > <mailto:struts-user-help@;jakarta.apache.org>
> >
> > --
> > To unsubscribe, e-mail:
> > <mailto:struts-user-unsubscribe@;jakarta.apache.org>
> > For additional commands, e-mail:
> > <mailto:struts-user-help@;jakarta.apache.org>
> >
> >
> >
> > --
> > To unsubscribe, e-mail:
> <mailto:struts-user-unsubscribe@;jakarta.apache.org>
> For additional commands, e-mail:
<mailto:struts-user-help@;jakarta.apache.org>

--
To unsubscribe, e-mail:
<mailto:struts-user-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail:
<mailto:struts-user-help@;jakarta.apache.org>



--
To unsubscribe, e-mail:   <mailto:struts-user-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-user-help@;jakarta.apache.org>

Reply via email to