Jackrabbit Content Repository
  1. Jackrabbit Content Repository
  2. JCR-3251

NullPointerException on property with same name as node

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Duplicate
    • Affects Version/s: None
    • Fix Version/s: 2.4
    • Component/s: jackrabbit-spi2dav
    • Labels:
      None

      Description

      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)

        Activity

        Hide
        angela added a comment -

        duplicate of JCR-1616

        Show
        angela added a comment - duplicate of JCR-1616
        Hide
        David Buchmann added a comment -

        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?

        Show
        David Buchmann added a comment - 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?

          People

          • Assignee:
            Unassigned
            Reporter:
            David Buchmann
          • Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development