You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by Sh...@sungard.com on 2003/07/17 15:50:26 UTC

Cryptic error message for null bean property

Hi all,

I ran into the same problem as mentioned in 

http://www.mail-archive.com/struts-user@jakarta.apache.org/msg72240.html

and I was able to track it down. In summary, the user has a control in
his JSP page:

<html:text property="apache.org" />

And while presenting an existing bean works fine, trying to populate a
new bean with the form data fails with a very cryptic error: 

java.lang.IllegalArgumentException: No bean specified
        at
org.apache.commons.beanutils.PropertyUtils.getPropertyDescriptor(Propert
yUtils.java:837)
        at
org.apache.commons.beanutils.BeanUtils.setProperty(BeanUtils.java:934)
        at
org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:808)
        ...

The cause is that in the form bean, before population, getApache()
returns null, and so setProperty is called as 

setProperty(null,"org",value)

(because the tag wants to execute the equivalent of
"bean.getApache().setOrg()") -- which throws the exception above. 

Now, I wonder if this can -- or should -- be fixed by Struts, Commons,
or whoever. At any rate, since (I think) with Struts the effect is more
surprising, a word about this should be dropped in the user's guide
where nested attributes are mentioned.

So -- should I submit a bug report? If so, where?

Thanks,
	Shai.

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-dev-help@jakarta.apache.org