You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Benedikt Ritter (Created) (JIRA)" <ji...@apache.org> on 2012/01/30 12:57:10 UTC
[jira] [Created] (SANDBOX-371) [BeanUtils2] Make sure that a
property is readable in DefaultBeanAccessor.getProperty( String name )
[BeanUtils2] Make sure that a property is readable in DefaultBeanAccessor.getProperty( String name )
----------------------------------------------------------------------------------------------------
Key: SANDBOX-371
URL: https://issues.apache.org/jira/browse/SANDBOX-371
Project: Commons Sandbox
Issue Type: Improvement
Components: BeanUtils2
Affects Versions: Nightly Builds
Reporter: Benedikt Ritter
Problem: The following statement in line 50 in DefaultBeanAccessor may cause a NullPointerException, because getReadMethod() will return null, if no getter for the property is present:
{code:java}Object newBean = propertyDescriptor.getReadMethod().invoke( bean ); {code}
Solution: throw a NoSuchMethodException, if the property is write only.
{code:java}
if ( propertyDescriptor.getReadMethod() == null )
{
throw new NoSuchMethodException( String.format( "Bean of type %s does not provide a getter for property '%s'!",
bean.getClass().getName(), name ) );
}{code}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Resolved] (SANDBOX-371) [BeanUtils2] Make sure that a
property is readable in DefaultBeanAccessor.getProperty( String name )
Posted by "Simone Tripodi (Resolved) (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/SANDBOX-371?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Simone Tripodi resolved SANDBOX-371.
------------------------------------
Resolution: Fixed
Assignee: Simone Tripodi
fixed on r1237703
> [BeanUtils2] Make sure that a property is readable in DefaultBeanAccessor.getProperty( String name )
> ----------------------------------------------------------------------------------------------------
>
> Key: SANDBOX-371
> URL: https://issues.apache.org/jira/browse/SANDBOX-371
> Project: Commons Sandbox
> Issue Type: Improvement
> Components: BeanUtils2
> Affects Versions: Nightly Builds
> Reporter: Benedikt Ritter
> Assignee: Simone Tripodi
> Attachments: SANDBOX-371.txt
>
>
> Problem: The following statement in line 50 in DefaultBeanAccessor may cause a NullPointerException, because getReadMethod() will return null, if no getter for the property is present:
> {code:java}Object newBean = propertyDescriptor.getReadMethod().invoke( bean ); {code}
> Solution: throw a NoSuchMethodException, if the property is write only.
> {code:java}
> if ( propertyDescriptor.getReadMethod() == null )
> {
> throw new NoSuchMethodException( String.format( "Bean of type %s does not provide a getter for property '%s'!",
> bean.getClass().getName(), name ) );
> }{code}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Updated] (SANDBOX-371) [BeanUtils2] Make sure that a
property is readable in DefaultBeanAccessor.getProperty( String name )
Posted by "Benedikt Ritter (Updated) (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/SANDBOX-371?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Benedikt Ritter updated SANDBOX-371:
------------------------------------
Attachment: SANDBOX-371.txt
I've created a patch. Summary:
* Added the above mentioned code to DefaultBeanAccessor.getProperty(String name)
* Extended GetPropertyTestCase
* Fixed wrong Annotion on GetPropertyTestCase, that caused the test to fail
* Changed assert messages on GetPropertyTestCase.getSimpleProperty()
> [BeanUtils2] Make sure that a property is readable in DefaultBeanAccessor.getProperty( String name )
> ----------------------------------------------------------------------------------------------------
>
> Key: SANDBOX-371
> URL: https://issues.apache.org/jira/browse/SANDBOX-371
> Project: Commons Sandbox
> Issue Type: Improvement
> Components: BeanUtils2
> Affects Versions: Nightly Builds
> Reporter: Benedikt Ritter
> Attachments: SANDBOX-371.txt
>
>
> Problem: The following statement in line 50 in DefaultBeanAccessor may cause a NullPointerException, because getReadMethod() will return null, if no getter for the property is present:
> {code:java}Object newBean = propertyDescriptor.getReadMethod().invoke( bean ); {code}
> Solution: throw a NoSuchMethodException, if the property is write only.
> {code:java}
> if ( propertyDescriptor.getReadMethod() == null )
> {
> throw new NoSuchMethodException( String.format( "Bean of type %s does not provide a getter for property '%s'!",
> bean.getClass().getName(), name ) );
> }{code}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira