[MGNLREST-145] Delivery endpoint returns exception when childNodeType has no sub configuration Created: 06/Nov/17  Updated: 09/Jan/18  Resolved: 26/Dec/17

Status: Closed
Project: Magnolia REST Framework
Component/s: None
Affects Version/s: None
Fix Version/s: 2.0.2

Type: Bug Priority: Major
Reporter: Christopher Zimmermann Assignee: Dai Ha
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: 0d
Time Spent: 2d
Original Estimate: 1d

Attachments: PNG File websiteConfigIsEmpty.png    
Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Bug DoR:
[ ]* Steps to reproduce, expected, and actual results filled
[ ]* Affected version filled
Date of First Response:
Epic Link: REST Phase2
Sprint: Saigon 127, Saigon 128, Saigon 129
Story Points: 1

 Description   

If you include the childNodeTypes item in a delivery configuration, and it has no configured items "under" it - then requests will get an exception:

java.lang.NullPointerException: null
	at info.magnolia.rest.delivery.jcr.filter.FilteringContentDecoratorBuilder.wrapNodeIterator(FilteringContentDecoratorBuilder.java:115) ~[magnolia-rest-content-delivery-2.0-SNAPSHOT.jar:?]

To reproduce, use this configuration

  stories:
    depth: 1
    includeSystemProperties: true
    bypassWorkspaceAcls: true
    #rootPath: /grandparent
    rootPath: /stories-demo2
    nodeTypes:
      0: mgnl:composition
    childNodeTypes:
    limit: 1

Expected behaviour is that no child nodes will be returned in the response.



 Comments   
Comment by Hieu Nguyen Duc [ 08/Jan/18 ]

Although the ticket has been fixed, there's another issue that may be not relevant but worth to check.
Steps:
+ Put this file into "modules"
"tour-finder-decorations/decorations/tourFinder/restEndpoints/tourFinder.yaml"

 params:
   website:
     bypassWorkspaceAcls: true
     nodeTypes:
       0: mgnl:page
     childNodeTypes:
       0: mgnl:page

+ "http://localhost:8080/magnoliaAuthor/.rest/delivery/website/v1" returns beautiful results

+ Remove "0: mgnl:page" in "childNodeTypes"

 params:
   website:
     bypassWorkspaceAcls: true
     nodeTypes:
       0: mgnl:page
     childNodeTypes:

+ "http://localhost:8080/magnoliaAuthor/.rest/delivery/website/v1" still show results but the "website" node in Definitions App is empty

=> If the endpoint works on "website", how come the "website" node is empty?!

Generated at Mon Feb 12 06:57:03 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.