[
https://issues.apache.org/jira/browse/JCR-2238?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12738927#action_12738927
]
Tobias Bocanegra commented on JCR-2238:
---------------------------------------
i think the creator is responsible to dispose the binary, no matter if the
binary was
- created using ValueFactory.createBinary(InputStream)
- retrieved from a property, eg: Property.getValue().getBinary();
- created in a own object implementing javax.jcr.Binary
the most common code is probably:
Binary bin = vf.createBinary(in);
try {
n.setProperty("foo", bin);
n.setProperty("bar", bin);
} finally {
bin.dispose();
}
> Binary throws NullPointerException
> -----------------------------------
>
> Key: JCR-2238
> URL: https://issues.apache.org/jira/browse/JCR-2238
> Project: Jackrabbit Content Repository
> Issue Type: Bug
> Components: jackrabbit-core
> Reporter: Marcel Reutegger
> Attachments: BinaryValueTest.patch
>
>
> Precondition: repository with datastore disabled!
> Steps to reproduce:
> 1) create binary from stream
> 2) set binary on property
> 3) dispose binary
> 4) get binary from property and dispose it immediately
> 5) go to 4)
> Binary.dispose() will throw a NullPointerException when 4) is executed the
> second time.
> The exception is not thrown if the property is saved after 2).
> See also attached test.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.