You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@brooklyn.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2017/09/21 12:53:00 UTC
[jira] [Commented] (BROOKLYN-538) IllegalArgumentException parsing
(null?) json response in http feed
[ https://issues.apache.org/jira/browse/BROOKLYN-538?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16174689#comment-16174689 ]
ASF GitHub Bot commented on BROOKLYN-538:
-----------------------------------------
GitHub user aledsage opened a pull request:
https://github.com/apache/brooklyn-server/pull/841
BROOKLYN-538: add failing test
Adds a test that demonstrates https://issues.apache.org/jira/browse/BROOKLYN-538
I'm going to mark issue as "won't fix" for the following reasons:
* The exception is benign - the sensor gets the expected value of `null`
* The exception happens deep within the `JsonPath` library - it might well be the right behaviour for it to fail if you ask for path `$` on a null object.
* Working around it in Brooklyn code would be added complexity for no real benefit.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/aledsage/brooklyn-server BROOKLYN-538-json-parsing-null
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/brooklyn-server/pull/841.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #841
----
commit 67f1661dbf6963423aaecb8dbf1399f00e356f55
Author: Aled Sage <al...@gmail.com>
Date: 2017-09-21T12:49:47Z
BROOKLYN-538: add failing test
----
> IllegalArgumentException parsing (null?) json response in http feed
> -------------------------------------------------------------------
>
> Key: BROOKLYN-538
> URL: https://issues.apache.org/jira/browse/BROOKLYN-538
> Project: Brooklyn
> Issue Type: Bug
> Reporter: Aled Sage
> Priority: Minor
>
> I found this exception in my log (using bleeding edge 0.12.0-SNAPSHOT):
> {noformat}
> 2017-09-20T14:44:22,427 WARN 122 o.a.b.c.f.AttributePollHandler [ger-H3hclarI-321] unable to compute VanillaSoftwareProcessImpl{id=s588wsizik}->Sensor: planeId (java.lang.String); on val=HttpToolResponse{responseCode=200}
> java.lang.IllegalArgumentException: json can not be null
> at com.jayway.jsonpath.internal.Utils.notNull(Utils.java:316) [71:com.jayway.jsonpath.json-path:2.4.0]
> at com.jayway.jsonpath.internal.JsonContext.<init>(JsonContext.java:47) [71:com.jayway.jsonpath.json-path:2.4.0]
> at com.jayway.jsonpath.internal.ParseContextImpl.parse(ParseContextImpl.java:38) [71:com.jayway.jsonpath.json-path:2.4.0]
> at com.jayway.jsonpath.JsonPath.read(JsonPath.java:502) [71:com.jayway.jsonpath.json-path:2.4.0]
> at org.apache.brooklyn.feed.http.JsonFunctions$GetPath.apply(JsonFunctions.java:320) [122:org.apache.brooklyn.core:0.12.0.SNAPSHOT]
> at org.apache.brooklyn.feed.http.JsonFunctions$GetPath.apply(JsonFunctions.java:310) [122:org.apache.brooklyn.core:0.12.0.SNAPSHOT]
> at com.google.common.base.Functions$FunctionComposition.apply(Functions.java:216) [66:com.google.guava:18.0.0]
> at org.apache.brooklyn.core.feed.AttributePollHandler.transformValueOnSuccess(AttributePollHandler.java:114) [122:org.apache.brooklyn.core:0.12.0.SNAPSHOT]
> at org.apache.brooklyn.core.feed.AttributePollHandler.onSuccess(AttributePollHandler.java:101) [122:org.apache.brooklyn.core:0.12.0.SNAPSHOT]
> at org.apache.brooklyn.core.feed.DelegatingPollHandler.onSuccess(DelegatingPollHandler.java:51) [122:org.apache.brooklyn.core:0.12.0.SNAPSHOT]
> at org.apache.brooklyn.core.feed.Poller$PollJob$1.run(Poller.java:79) [122:org.apache.brooklyn.core:0.12.0.SNAPSHOT]
> at org.apache.brooklyn.core.feed.Poller$1$1.call(Poller.java:160) [122:org.apache.brooklyn.core:0.12.0.SNAPSHOT]
> at org.apache.brooklyn.core.feed.Poller$1$1.call(Poller.java:153) [122:org.apache.brooklyn.core:0.12.0.SNAPSHOT]
> at org.apache.brooklyn.util.core.task.DynamicSequentialTask$DstJob.call(DynamicSequentialTask.java:363) [122:org.apache.brooklyn.core:0.12.0.SNAPSHOT]
> at org.apache.brooklyn.util.core.task.BasicExecutionManager$ScheduledTaskCallable$1.call(BasicExecutionManager.java:451) [122:org.apache.brooklyn.core:0.12.0.SNAPSHOT]
> at org.apache.brooklyn.util.core.task.BasicExecutionManager$SubmissionCallable.call(BasicExecutionManager.java:529) [122:org.apache.brooklyn.core:0.12.0.SNAPSHOT]
> at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:?]
> at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:?]
> at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:?]
> at java.lang.Thread.run(Thread.java:748) [?:?]
> {noformat}
> I presume it came from this http feed:
> {noformat}
> - type: org.apache.brooklyn.core.sensor.http.HttpRequestSensor
> brooklyn.config:
> name: planeId
> period: 5s
> jsonPath: "$"
> uri:
> $brooklyn:formatString:
> - "%s/v1/server/planeid"
> - $brooklyn:attributeWhenReady("main.uri.public")
> {noformat}
> My guess is that the api returned {{null}}, but I've not yet tried writing a unit test to reproduce.
> I'd have expected this to return the json value of {{null}} if that's what the value is.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)