Uploaded image for project: '[Read Only] - Hippo Site Toolkit 2'
  1. [Read Only] - Hippo Site Toolkit 2
  2. HSTTWO-4630

Content REST API - Document detail resource throws error when there's an author request

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Normal
    • Resolution: Fixed
    • 13.1.3, 13.2.2, 13.3.0
    • 13.3.1, 13.4.0, 14.0.0
    • None
    • None
    • Flagged
    • Platform 213 SSO Delivery 3, Platform 214

    Description

      In version 13.x, the org.hippoecm.hst.restapi.content.visitors.HippoHandleVisitor class has added a new method getPublishedVariant(final Node node). That is causing a problem when there's a (de)publication request by the author. Because the code snippet below does not take into account that there is a hippo:request node under the handle in this case which does not have a hippostd:state property, resulting in a javax.jcr.PathNotFoundException: hippostd:state being thrown.

      final NodeIterator nodeIterator = node.getNodes();
      Node variant = null;
      while (nodeIterator.hasNext()){
          Node currentNode = nodeIterator.nextNode();
       
       
       
       if(currentNode.getProperty(HippoStdNodeType.HIPPOSTD_STATE).getString().equals(HippoStdNodeType.PUBLISHED)){
              variant = currentNode;
          }
      }
      

      To reproduce the issue:

      1. Create a vanilla v13.x project using the archetype;
      2. Add some sample documents and setup the Content REST API endpoint using essentials;
      3. Using http://localhost:8080/site/api/documents/

      {uuid}

      to fetch any document, with {uuid}

      being the document's handle UUID;
      4. Now login to the cms as an author, and make some changes to the document in 3, then save and request publication;
      5. Now try the same URL in 3, and you will get the following JSON response:

      {"status": 404, "description": "javax.jcr.PathNotFoundException: hippostd:state"}
      

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              cchen Charlie Chen
              Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: