[
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.