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

Version node still accessible after transaction rollback

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Duplicate
    • core 1.4.5
    • None
    • None
    • Windows Vista, Java 1.5.0, Derby Database for versioning and workspace, JUnit 4 Testcase

    Description

      • Open a transaction
      • Add a new versionable node and check it in
      • Save the uuid of the version node returned by node.checkin()
      • Rollback transaction AND call session.refresh(false)
      • access version node by session.getNodeByUUID()
        ==> in spite of the rollback the version node is still found. If the path of the version node is used to look it up (session.getItem()), it fails

      The following JUnit 4 test case demonstrates the problem:

      @Test
      public void testRollbackInline() throws Exception

      { // start transaction for session UserTransactionImpl tx = new UserTransactionImpl(superuser); tx.begin(); // add new node and save Node node = superuser.getRootNode().addNode("test001", "nt:unstructured"); node.addMixin("mix:versionable"); superuser.save(); // checkin version and save uuid Version v = node.checkin(); String uuid = v.getUUID(); // rollback transaction for session tx.rollback(); // clear transient storage superuser.refresh(false); // check, whether new version was really "rolled back" assertFalse(hasVersionWorks(uuid)); assertFalse(hasVersionFails(uuid)); }

      private boolean hasVersionFails(String versionId) throws RepositoryException {
      boolean hasVersion;
      try

      { Node nodeByUUID = superuser.getNodeByUUID(versionId); hasVersion = nodeByUUID != null; }

      catch (ItemNotFoundException e)

      { hasVersion = false; }
      if (hasVersion)
      System.err.println("hasVersionFailing: " + versionId + " ==> FOUND");
      else
      System.err.println("hasVersionFailing: " + versionId + " ==> NOT FOUND");
      return hasVersion;
      }

      private boolean hasVersionWorks(String versionId) throws RepositoryException {
      boolean hasVersion;
      try { Node nodeByUUID = superuser.getNodeByUUID(versionId); String path = nodeByUUID.getPath(); hasVersion = superuser.itemExists(path); } catch (ItemNotFoundException e) { hasVersion = false; }

      if (hasVersion)
      System.err.println("hasVersionWorking: " + versionId + " ==> FOUND");
      else
      System.err.println("hasVersionWorking: " + versionId + " ==> NOT FOUND");
      return hasVersion;
      }

      I will try to attach the complete test sources, which also shows the setup of the repository, though I did nothing special there.

      Attachments

        1. TransactionTest.java
          3 kB
          Rüdiger Groß-Hardt
        2. UserTransactionImpl.java
          7 kB
          Rüdiger Groß-Hardt

        Issue Links

          Activity

            People

              Unassigned Unassigned
              hardy_65 Rüdiger Groß-Hardt
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: