[
https://issues.apache.org/jira/browse/CURATOR-395?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15971689#comment-15971689
]
ASF GitHub Bot commented on CURATOR-395:
----------------------------------------
Github user cammckenzie commented on the issue:
https://github.com/apache/curator/pull/213
I think that the fix is fine, but why is the createMethod a lazily
instantiated reference? Couldn't it just be a normal reference that gets
created in the constructor? We seem to have everything we need there to create
it.
> Potential null dereference in PersistentNode
> --------------------------------------------
>
> Key: CURATOR-395
> URL: https://issues.apache.org/jira/browse/CURATOR-395
> Project: Apache Curator
> Issue Type: Bug
> Reporter: Ted Yu
> Assignee: Jordan Zimmerman
> Priority: Minor
>
> {code}
> if ( localCreateMethod == null )
> {
> CreateModable<ACLBackgroundPathAndBytesable<String>>
> tempCreateMethod = useProtection ?
> client.create().creatingParentContainersIfNeeded().withProtection() :
> client.create().creatingParentContainersIfNeeded();
> if ( createMethod.compareAndSet(null, tempCreateMethod) )
> {
> localCreateMethod = tempCreateMethod;
> }
> }
> localCreateMethod.withMode(getCreateMode(existingPath !=
> null)).inBackground(backgroundCallback).forPath(createPath, data.get());
> {code}
> Before calling withMode(), localCreateMethod should be checked against null.
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)