jackrabbit-oak-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chetan Mehrotra <chetan.mehro...@gmail.com>
Subject Return value for setting the property value to null using Node.setProperty
Date Sat, 27 Oct 2012 18:03:11 GMT
While importing a content package using current Oak codebase I am
getting following exception

5203 [main] ERROR
com.day.jcr.vault.packaging.impl.JcrPackageDefinitionImpl - error
while saving properties.
javax.jcr.PathNotFoundException: buildCount not found on
/etc/packages/adobe/granite/com.adobe.granite.platform.content-0.2.44.zip/jcr:content/vlt:definition
	at org.apache.jackrabbit.oak.jcr.NodeImpl$11.perform(NodeImpl.java:557)
	at org.apache.jackrabbit.oak.jcr.NodeImpl$11.perform(NodeImpl.java:551)
	at org.apache.jackrabbit.oak.jcr.SessionDelegate.perform(SessionDelegate.java:120)
	at org.apache.jackrabbit.oak.jcr.NodeImpl.getProperty(NodeImpl.java:551)
	at org.apache.jackrabbit.oak.jcr.NodeImpl$32.perform(NodeImpl.java:1493)
	at org.apache.jackrabbit.oak.jcr.NodeImpl$32.perform(NodeImpl.java:1489)
	at org.apache.jackrabbit.oak.jcr.SessionDelegate.perform(SessionDelegate.java:120)
	at org.apache.jackrabbit.oak.jcr.NodeImpl.internalSetProperty(NodeImpl.java:1489)
	at org.apache.jackrabbit.oak.jcr.NodeImpl.setProperty(NodeImpl.java:369)
	at com.day.jcr.vault.packaging.impl.JcrPackageDefinitionImpl.writeProperties(JcrPackageDefinitionImpl.java:394)
	at com.day.jcr.vault.packaging.impl.JcrPackageDefinitionImpl.unwrap(JcrPackageDefinitionImpl.java:222)
	at com.day.jcr.vault.packaging.impl.JcrPackageImpl.createNew(JcrPackageImpl.java:219)
	at com.day.jcr.vault.packaging.impl.JcrPackageManagerImpl.upload(JcrPackageManagerImpl.java:234)
	at com.day.jcr.vault.packaging.impl.JcrPackageManagerImpl.upload(JcrPackageManagerImpl.java:183)

Here the value of 'buildCount' is being set to null. As per JCR spec
setting null is equivalent to removing the property. The problem is
NodeImpl.internalSetProperty first looks up the property and then
removes it which leads to PathNotFoundException as property does not
exist earlier. Earlier this code used to return null. However even
that behaviour differs from the current JR 2.0 logic, which first
creates such a property and then removes it and returns a
PropertyImpl.

So what should be the behaviour here

1. Return null
2. OR return a PropertyImpl even for property which does not existed earlier.

Chetan Mehrotra

Mime
View raw message