Knotx / knotx

Knot.x is a highly-efficient and scalable integration framework designed to build backend APIs
https://knotx.io
Apache License 2.0
126 stars 26 forks source link

[S] When Service returns response without `body` - NPE in ServiceEngine #176

Closed malaskowski closed 7 years ago

malaskowski commented 8 years ago

When Service Adapter returns clientResponse without body following exception occurs:

java.util.NoSuchElementException: No value present
    at java.util.Optional.get(Optional.java:135) ~[na:1.8.0_91]
    at com.cognifide.knotx.knot.view.service.ServiceEngine.mergeWithConfiguration(ServiceEngine.java:72) ~[knotx-example-monolith-0.6.0-SNAPSHOT-fat.jar:na]
    at rx.internal.operators.OnSubscribeMap$MapSubscriber.onNext(OnSubscribeMap.java:69) ~[knotx-example-monolith-0.6.0-SNAPSHOT-fat.jar:na]
    at rx.observers.Subscribers$5.onNext(Subscribers.java:235) ~[knotx-example-monolith-0.6.0-SNAPSHOT-fat.jar:na]

E.g. case:

Service response with status code 200 and body response when resource is available. Otherwise service response is status code 400 with no body.

tomaszmichalak commented 7 years ago

To verify.

zajcu commented 7 years ago

Here you have 2 different things:

  1. when service response has empty body, allow to display page without service body values in html (integration test added here https://github.com/Cognifide/knotx/pull/198/files)

  2. when configuration for using service is missing, in fragment processing is: java.util.NoSuchElementException: No value present improvement for logging this issue will be done in another task (https://github.com/Cognifide/knotx/issues/199)

tomaszmichalak commented 7 years ago

When I changed fourh.json from "{}" to "" I had 500 error.