-
Bug
-
Resolution: Done
-
Critical
-
2.5.2.GA
-
None
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; } }