On 11/20/05, Aleksandar Pecanov <[EMAIL PROTECTED]> wrote:
>
>
>
> ---------- Forwarded message ----------
> From: Aleksandar Pecanov <[EMAIL PROTECTED]>
> To: [EMAIL PROTECTED]
> Date: Sun, 20 Nov 2005 00:57:42 +0100
> Subject: Re: removing reference properties
> Sure:
>
> // nodeTypeName is a custom node type with one single value REFERENCE
> property
> documentNode = parentNode.addNode(document.getName(), nodeTypeName);
>
> // This line is of no importance
> document.setUUID(UUID.fromString(documentNode.getUUID()));
>
> if( linkId!=null ) {
> Node node =
> session.getSession().getNodeByUUID(linkId.toString());
> // This is the REFERENCE property:
>
> documentNode.setProperty(LinkReferencePropertyDefinition.NAME,
> node);
> // This is where the NullPointerException is thrown:
> session.getSession().save();
> return;
> }
>
> None of the nodes involved are versionable and it still throws a
> NullPointerException somewhere in VersionManagerImpl !?
>
i tested with the following node type definition:
<nodeType name="test" isMixin="false" hasOrderableChildNodes="false"
primaryItemName="ref">
<supertypes>
<supertype>nt:base</supertype>
</supertypes>
<propertyDefinition name="ref" requiredType="Reference"
autoCreated="false" mandatory="false" onParentVersion="COPY"
protected="false" multiple="false" />
</nodeType>
and the following code:
// setup test
if (root.hasNode("test")) {
root.getNode("test").remove();
}
if (root.hasNode("refTarget")) {
root.getNode("refTarget").remove();
}
Node refTarget = root.addNode("refTarget");
refTarget.addMixin("mix:referenceable");
session.save();
String uuid = refTarget.getUUID();
// test case: set reference property and save
Node test = root.addNode("test", "test");
refTarget = session.getNodeByUUID(uuid);
Property ref = test.setProperty("ref", refTarget);
session.save();
==> everything worked as expected, i.e. i couldn't reproduce your problem.
please create a jira issue and include all relevant information
(i.e. error log, repository.xml, workspace.xml, custom_nodetypes.xml)
and some code to reproduce the problem.
thanks
stefan