You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by "Jukka Zitting (JIRA)" <ji...@apache.org> on 2009/04/27 17:02:34 UTC

[jira] Moved: (OCM-10) A protected getter method without FIELD annotation can make NPE.

     [ https://issues.apache.org/jira/browse/OCM-10?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jukka Zitting moved JCR-2022 to OCM-10:
---------------------------------------

        Fix Version/s:     (was: 1.6.0)
          Component/s:     (was: jackrabbit-ocm)
    Affects Version/s:     (was: 1.5.5)
                           (was: 1.5.4)
                           (was: 1.6.0)
             Workflow: no-reopen-closed, patch-avail  (was: jira)
                  Key: OCM-10  (was: JCR-2022)
              Project: Jackrabbit OCM  (was: Jackrabbit Content Repository)

> A protected getter method without FIELD annotation can make NPE.
> ----------------------------------------------------------------
>
>                 Key: OCM-10
>                 URL: https://issues.apache.org/jira/browse/OCM-10
>             Project: Jackrabbit OCM
>          Issue Type: Bug
>            Reporter: Woonsan Ko
>            Priority: Minor
>         Attachments: jackrabbit-1.6-SNAPSHOT-getter-anno.patch
>
>
> If a bean is define like the following, then AnnotationDescriptorReader throws NPE.
> Note that 'encodedTest' property is not annotated for internal use, but the getter method is not public for some reason (it is possible!).
> @Node
> public class SimpleGetterAnnotedBaseClass {
>     String path; 
>     String test;
>     String encodedTest;
>     
>     @Field(path=true)
>     public String getPath() {
>         return path;
>     }
>     public void setPath(String path) {
>         this.path = path;
>     } 
>     @Field
>     public String getTest() {
>         return test;
>     }
>     public void setTest(String test) {
>         this.test = test;
>     }
>     
>     protected String getEncodedTest() {
>         if (encodedTest == null && test != null) {
>             encodedTest = "test to be encoded: " + test;
>         }
>         
>         return encodedTest;
>     }
>     
>     public void setEncodedTest(String encodedTest) {
>         this.encodedTest = encodedTest;
>     }
>         
> }
> To avoid the NPE, AnnotationDescriptorReader must check if the propertyDescriptor.getReadMethod() returns null.
> I will post a patch for this right now.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.