Details
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/
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
- relates to
-
HSTTWO-4330 Content Rest API get variant node error
- Closed