You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by "Woonsan Ko (JIRA)" <ji...@apache.org> on 2009/03/13 11:47:50 UTC

[jira] Created: (JCR-2022) A protected getter method without FIELD annotation can make NPE.

A protected getter method without FIELD annotation can make NPE.
----------------------------------------------------------------

                 Key: JCR-2022
                 URL: https://issues.apache.org/jira/browse/JCR-2022
             Project: Jackrabbit Content Repository
          Issue Type: Bug
    Affects Versions: 1.5.4, 1.5.5, 1.6.0
            Reporter: Woonsan Ko
             Fix For: 1.6.0
         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.


[jira] Updated: (JCR-2022) A protected getter method without FIELD annotation can make NPE.

Posted by "Woonsan Ko (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/JCR-2022?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Woonsan Ko updated JCR-2022:
----------------------------

    Attachment: jackrabbit-1.6-SNAPSHOT-getter-anno.patch

A patch to resolve this issue.
Thanks!

> A protected getter method without FIELD annotation can make NPE.
> ----------------------------------------------------------------
>
>                 Key: JCR-2022
>                 URL: https://issues.apache.org/jira/browse/JCR-2022
>             Project: Jackrabbit Content Repository
>          Issue Type: Bug
>    Affects Versions: 1.5.4, 1.5.5, 1.6.0
>            Reporter: Woonsan Ko
>             Fix For: 1.6.0
>
>         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.


[jira] Updated: (JCR-2022) A protected getter method without FIELD annotation can make NPE.

Posted by "Woonsan Ko (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/JCR-2022?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Woonsan Ko updated JCR-2022:
----------------------------

    Component/s: jackrabbit-ocm
       Priority: Minor  (was: Major)

> A protected getter method without FIELD annotation can make NPE.
> ----------------------------------------------------------------
>
>                 Key: JCR-2022
>                 URL: https://issues.apache.org/jira/browse/JCR-2022
>             Project: Jackrabbit Content Repository
>          Issue Type: Bug
>          Components: jackrabbit-ocm
>    Affects Versions: 1.5.4, 1.5.5, 1.6.0
>            Reporter: Woonsan Ko
>            Priority: Minor
>             Fix For: 1.6.0
>
>         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.


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

Posted by "Jukka Zitting (JIRA)" <ji...@apache.org>.
     [ 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.