jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Buchmann (Commented) (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (JCR-3251) NullPointerException on property with same name as node
Date Tue, 06 Mar 2012 19:13:59 GMT

    [ https://issues.apache.org/jira/browse/JCR-3251?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13223562#comment-13223562
] 

David Buchmann commented on JCR-3251:
-------------------------------------

investigating further, i notice that the request to get the node contains a peculiar json:

{"toast":"bar",":jcr:primaryType":"Name","jcr:primaryType":"nt:unstructured","toast":{}}

according to this for example, i think that duplicated keys are invalid in json
http://www.json.org/javadoc/org/json/JSONObject.html#JSONObject%28java.lang.String%29

php json_decode and online javascript parsers seem to accept but just update the key "toast"
to the second value which is the empty list indicating a child node. but aparently jackrabbit
can handle this - is it using a modified parser and some sort of non-standard json notion
that allows duplicated keys?
                
> 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

        

Mime
View raw message