Uploaded image for project: 'Jackrabbit Content Repository'
  1. Jackrabbit Content Repository
  2. JCR-3251

NullPointerException on property with same name as node

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Duplicate
    • None
    • 2.4
    • jackrabbit-spi2dav
    • 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)

      Attachments

        Activity

          People

            Unassigned Unassigned
            dbu David Buchmann
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: