Uploaded image for project: 'ModeShape'
  1. ModeShape
  2. MODE-1302

PathNotFoundException when trying to retrieve version history for a node.

    Details

      Description

      Following code fragment will produce javax.jcr.PathNotFoundException: Unable to find "{}outerFolder[2]/{}innerFolder/{}testFile.dat"; lowest existing path is "/".
      Occurs for inmemory and jpa repositories.

      Repository repository = RepositoryReferenceFactory.getRepository("test-inmemory");
      Session session = repository.login();
      VersionManager vm = session.getWorkspace().getVersionManager();
      		
      Node outer = session.getRootNode().addNode("outerFolder");
      Node inner = outer.addNode("innerFolder");
      Node file  = inner.addNode("testFile.dat");
      file.setProperty("jcr:mimeType", "text/plain");
      file.setProperty("jcr:data", "Original content");
      session.save();
      		
      isVersionable(vm, file);
      file.addMixin("mix:versionable");
      session.refresh(true);
      isVersionable(vm, file);
      
      boolean isVersionable(VersionManager vm, Node node) throws RepositoryException {
          try {
              vm.getVersionHistory(node.getPath());
              return true;
          } catch (UnsupportedRepositoryOperationException e) {
              return false;
          }
      }
      

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  hchiorean Horia Chiorean
                  Reporter:
                  mbaluch Marek Baluch
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  5 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: