You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Davide Bruzzone <Da...@ngt.com> on 2002/11/21 23:39:27 UTC

Mysterious PropertyUtils problem...

Greetings all...

Has anyone ever seen something like this happen?

	java.lang.NullPointerException
	at java.beans.Introspector.addMethod(Introspector.java:741)
	at
java.beans.Introspector.getTargetMethodInfo(Introspector.java:705)
	at java.beans.Introspector.getBeanInfo(Introspector.java:298)
	at java.beans.Introspector.getBeanInfo(Introspector.java:81)
	at
org.apache.commons.beanutils.PropertyUtils.getPropertyDescriptors(PropertyUt
ils.java:925)
	at
org.apache.commons.beanutils.PropertyUtils.getPropertyDescriptors(PropertyUt
ils.java:955)
	at
org.apache.commons.beanutils.PropertyUtils.getPropertyDescriptor(PropertyUti
ls.java:866)
	at
org.apache.commons.beanutils.PropertyUtils.getSimpleProperty(PropertyUtils.j
ava:1148)
	at
org.apache.commons.beanutils.PropertyUtils.getNestedProperty(PropertyUtils.j
ava:751)
	at
org.apache.commons.beanutils.PropertyUtils.getProperty(PropertyUtils.java:78
0)
	at
com.ngt.baseframework.presentation.taglib.struts.OptionsTag.processValue(Opt
ionsTag.java:449)
	at
com.ngt.baseframework.presentation.taglib.struts.OptionsTag.doEndTag(Options
Tag.java:327)

Here's some background:

- No code has changed... This was working fine this morning!#$@...
- Here's the custom tag code (OptionsTag.java) that blows up (in the
processValue method):

	result.append(PropertyUtils.getProperty(element, valueProperty));

result is a StringBuffer of course...

So this code works when valueProperty is one value, then it blows up when
valueProperty changes and is equal to "title" (i.e. It blows up when it hits
the second dropdown). The element object is an instance of an object that
has a title attribute, as well as a getter/setter for the attribute. The
object even has a corresponding BeanInfo class that contains the following
code:

...
private static final int PROPERTY_title = 31;  
...
properties[PROPERTY_title] = new PropertyDescriptor ( "title",
AssociateContactBO.class, "getTitle", "setTitle" );
...

>From the stack trace, it looks to me like the BeanInfo class has been
retrieved successfully, and a Method object is being added to some
collection and maybe this method object can't be found for some reason? I'm
not stepping through the code, so I'm just guessing here...

Any clever insight would be greatly appreciated, but at this point I'd just
be happy if someone pointed out some stupid mistake that I've made.

Cheers...

Dave Bruzzone 

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Mysterious PropertyUtils problem...

Posted by "Craig R. McClanahan" <cr...@apache.org>.

On Thu, 21 Nov 2002, Davide Bruzzone wrote:

> Date: Thu, 21 Nov 2002 15:39:27 -0700
> From: Davide Bruzzone <Da...@ngt.com>
> Reply-To: Struts Users Mailing List <st...@jakarta.apache.org>
> To: 'Struts Users Mailing List' <st...@jakarta.apache.org>
> Subject: Mysterious PropertyUtils problem...
>
> Greetings all...
>
> Has anyone ever seen something like this happen?
>
> 	java.lang.NullPointerException
> 	at java.beans.Introspector.addMethod(Introspector.java:741)
> 	at
> java.beans.Introspector.getTargetMethodInfo(Introspector.java:705)
> 	at java.beans.Introspector.getBeanInfo(Introspector.java:298)
> 	at java.beans.Introspector.getBeanInfo(Introspector.java:81)
> 	at
> org.apache.commons.beanutils.PropertyUtils.getPropertyDescriptors(PropertyUt
> ils.java:925)

Sounds like a bug in the JDK's introspection class.  I've heard that 1.3.1
has some problems in this area -- is that what you're using?  If it is a
JDK bug, then the only suggestion would be to update (I'm pretty happy
with 1.4.1's improvements in speed and reduced GC overhead).

Craig


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>