You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by "Baltz, Kenneth" <Kb...@firstam.com> on 2003/02/04 00:53:01 UTC

RE: [digester] - v1.4 breaks existing code : property has no gett er method

Looks like you have it right.  Here's the code from the fix:

	// Force an exception if the property does not exist
	// (BeanUtils.setProperty() sildently returns in this case)
	PropertyUtils.getProperty(top, actualName);
              
	// Set the property (with conversion as necessary)
	BeanUtils.setProperty(top, actualName, actualValue);

I'm sure it fails in PropertyUtils.getProperty for your code.  

It looks like the problem is ultimately with BeanUtils.setProperty.  Maybe a
bug should be filed against BeanUtils?  I guess it depends on the design
intent of Digester (i.e. is it intended for Beans only).

K.C.

> -----Original Message-----
> From: Simon Kitching [mailto:simon@ecnetwork.co.nz]
> Sent: Monday, February 03, 2003 3:36 PM
> To: commons-user@jakarta.apache.org
> Subject: [digester] - v1.4 breaks existing code : property 
> has no getter
> method
> 
> 
> Hi,
> 
> I have just downloaded release 1.4 of digester & given it a spin.
> 
> My existing code now fails with the following exception:
> 
> ERROR: org.apache.commons.digester.Digester: 2003-02-04 11:08:52,011
> [main] (Digester.java:1066) - End event threw exception
> java.lang.NoSuchMethodException: Property 'identifier' has no getter
> method
> 
> Is this related to the fix for bug 16233, "Invalid bean setters do not
> generate an exception"?
> 
> I believe the error message is referring to the fact that I 
> have classes
> instantiated/populated via digester rules which have setter methods
> without getter methods (eg setIdentifier without getIdentifier in this
> case). The attributes being set are only accessed by the class
> concerned, and therefore it makes no sense for these to have getter
> methods. I understand that this might be a violation of the 
> "java bean"
> rules, but I don't believe that digester is intended to populate only
> beans.
> 
> I agree with the original bug that a rule which explicitly 
> tries to set
> a nonexistent property should report an error; I am hoping the above
> problem is an accidental side-effect of the fix for this.
> 
> Any comments?
> 
> Regards,
> 
> Simon
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
> 
> 

Re: [digester] - v1.4 breaks existing code : property has no gett er method

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

On Tue, 4 Feb 2003, Craig R. McClanahan wrote:

> Date: Tue, 4 Feb 2003 16:50:06 -0800 (PST)
> From: Craig R. McClanahan <cr...@apache.org>
> Reply-To: Jakarta Commons Users List <co...@jakarta.apache.org>
> To: Jakarta Commons Users List <co...@jakarta.apache.org>
> Subject: Re: [digester] - v1.4 breaks existing code : property has no
>     gett er method
>
>
>
> On Tue, 4 Feb 2003, robert burrell donkin wrote:
>
> > Date: Tue, 4 Feb 2003 23:25:02 +0000
> > From: robert burrell donkin <ro...@blueyonder.co.uk>
> > Reply-To: Jakarta Commons Users List <co...@jakarta.apache.org>
> > To: Jakarta Commons Users List <co...@jakarta.apache.org>
> > Subject: Re: [digester] - v1.4 breaks existing code : property has no
> >     gett er method
> >
> > i've confirmed this behaviour and it looks like a bug to me. i'm not sure
> > the best way to fix it as yet.
> >
>
> Yep ... definitely a bug, in Digester (I just confirmed that the new HEAD
> code in beanutils does correctly set a write-only property).
>
> I'm working on a Digester fix right now (will need to use a different
> mechanism to detect whether the property actually exists).
>

Fixed in Digester nightly build 20030205, and in an upcoming patch
release.

> > - robert
>
> Craig
>

Craig

Re: [digester] - v1.4 breaks existing code : property has no gett er method

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

On Tue, 4 Feb 2003, robert burrell donkin wrote:

> Date: Tue, 4 Feb 2003 23:25:02 +0000
> From: robert burrell donkin <ro...@blueyonder.co.uk>
> Reply-To: Jakarta Commons Users List <co...@jakarta.apache.org>
> To: Jakarta Commons Users List <co...@jakarta.apache.org>
> Subject: Re: [digester] - v1.4 breaks existing code : property has no
>     gett er method
>
> i've confirmed this behaviour and it looks like a bug to me. i'm not sure
> the best way to fix it as yet.
>

Yep ... definitely a bug, in Digester (I just confirmed that the new HEAD
code in beanutils does correctly set a write-only property).

I'm working on a Digester fix right now (will need to use a different
mechanism to detect whether the property actually exists).

> - robert

Craig

Re: [digester] - v1.4 breaks existing code : property has no gett er method

Posted by robert burrell donkin <ro...@blueyonder.co.uk>.
i've confirmed this behaviour and it looks like a bug to me. i'm not sure 
the best way to fix it as yet.

- robert

On Monday, February 3, 2003, at 11:53 PM, Baltz, Kenneth wrote:

> Looks like you have it right.  Here's the code from the fix:
>
> 	// Force an exception if the property does not exist
> 	// (BeanUtils.setProperty() sildently returns in this case)
> 	PropertyUtils.getProperty(top, actualName);
>
> 	// Set the property (with conversion as necessary)
> 	BeanUtils.setProperty(top, actualName, actualValue);
>
> I'm sure it fails in PropertyUtils.getProperty for your code.
>
> It looks like the problem is ultimately with BeanUtils.setProperty.  
> Maybe a
> bug should be filed against BeanUtils?  I guess it depends on the design
> intent of Digester (i.e. is it intended for Beans only).
>
> K.C.
>
>> -----Original Message-----
>> From: Simon Kitching [mailto:simon@ecnetwork.co.nz]
>> Sent: Monday, February 03, 2003 3:36 PM
>> To: commons-user@jakarta.apache.org
>> Subject: [digester] - v1.4 breaks existing code : property
>> has no getter
>> method
>>
>>
>> Hi,
>>
>> I have just downloaded release 1.4 of digester & given it a spin.
>>
>> My existing code now fails with the following exception:
>>
>> ERROR: org.apache.commons.digester.Digester: 2003-02-04 11:08:52,011
>> [main] (Digester.java:1066) - End event threw exception
>> java.lang.NoSuchMethodException: Property 'identifier' has no getter
>> method
>>
>> Is this related to the fix for bug 16233, "Invalid bean setters do not
>> generate an exception"?
>>
>> I believe the error message is referring to the fact that I
>> have classes
>> instantiated/populated via digester rules which have setter methods
>> without getter methods (eg setIdentifier without getIdentifier in this
>> case). The attributes being set are only accessed by the class
>> concerned, and therefore it makes no sense for these to have getter
>> methods. I understand that this might be a violation of the
>> "java bean"
>> rules, but I don't believe that digester is intended to populate only
>> beans.
>>
>> I agree with the original bug that a rule which explicitly
>> tries to set
>> a nonexistent property should report an error; I am hoping the above
>> problem is an accidental side-effect of the fix for this.
>>
>> Any comments?
>>
>> Regards,
>>
>> Simon
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>>
>>