NullPointerException on property with same name as node
-------------------------------------------------------
Key: JCR-3251
URL: https://issues.apache.org/jira/browse/JCR-3251
Project: Jackrabbit Content Repository
Issue Type: Bug
Components: jackrabbit-spi2dav
Reporter: David Buchmann
Fix For: 2.4
when a node has a child node and a property with the same name, getting the
property without previously getting the node having the property results in a
NullPointerException.
the repository is something like this:
<test toast="bar">
<toast/>
</test>
Session s = repository.login(credentials,workspace);
Node n = s.getRootNode().addNode("test");
n.setProperty("toast", "bar");
n.addNode("toast");
s.save();
s = repository.login(credentials,workspace);
n = s.getNode("/test/toast");
System.out.println(s.itemExists("/test/toast")); // true
// enabling the following line makes the code run without exception (getting
the test node which has the toast property)
// n.getParent();
Property p = s.getProperty("/test/toast");
Exception in thread "main" java.lang.NullPointerException
at
org.apache.jackrabbit.spi2davex.RepositoryServiceImpl.getPropertyInfo(RepositoryServiceImpl.java:398)
at
org.apache.jackrabbit.spi2davex.RepositoryServiceImpl.getItemInfos(RepositoryServiceImpl.java:335)
at
org.apache.jackrabbit.jcr2spi.state.WorkspaceItemStateFactory.createDeepPropertyState(WorkspaceItemStateFactory.java:201)
at
org.apache.jackrabbit.jcr2spi.state.TransientISFactory.createDeepPropertyState(TransientISFactory.java:125)
at
org.apache.jackrabbit.jcr2spi.hierarchy.NodeEntryImpl.loadPropertyEntry(NodeEntryImpl.java:1179)
at
org.apache.jackrabbit.jcr2spi.hierarchy.NodeEntryImpl.getDeepPropertyEntry(NodeEntryImpl.java:509)
at
org.apache.jackrabbit.jcr2spi.hierarchy.HierarchyManagerImpl.getPropertyEntry(HierarchyManagerImpl.java:173)
at
org.apache.jackrabbit.jcr2spi.ItemManagerImpl.getProperty(ItemManagerImpl.java:186)
at
org.apache.jackrabbit.jcr2spi.SessionImpl.getProperty(SessionImpl.java:537)
at Client.main(Client.java:35)
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira