Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[sensebox] Gracefully handle JsonSyntaxException #10348

Merged
merged 1 commit into from
Mar 26, 2021

Conversation

cweitkamp
Copy link
Contributor

  • Gracefully handle JsonSyntaxException
2021-03-17 10:55:02.872 [WARN ] [mmon.WrappedScheduledExecutorService] - Scheduled runnable ended with an exception: 
com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was NUMBER at line 1 column 4 path $
        at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:224) ~[?:?]
        at com.google.gson.Gson.fromJson(Gson.java:888) ~[?:?]
        at com.google.gson.Gson.fromJson(Gson.java:853) ~[?:?]
        at com.google.gson.Gson.fromJson(Gson.java:802) ~[?:?]
        at com.google.gson.Gson.fromJson(Gson.java:774) ~[?:?]
        at org.openhab.binding.sensebox.internal.SenseBoxAPIConnection.reallyFetchDataFromServer(SenseBoxAPIConnection.java:70) ~[?:?]
        at org.openhab.binding.sensebox.internal.handler.SenseBoxHandler.lambda$0(SenseBoxHandler.java:106) ~[?:?]
        at org.openhab.core.cache.ExpiringCache.refreshValue(ExpiringCache.java:101) ~[?:?]
        at org.openhab.core.cache.ExpiringCache.getValue(ExpiringCache.java:72) ~[?:?]
        at org.openhab.core.cache.ExpiringCacheMap.get(ExpiringCacheMap.java:198) ~[?:?]
        at org.openhab.binding.sensebox.internal.handler.SenseBoxHandler.fetchData(SenseBoxHandler.java:163) ~[?:?]
        at org.openhab.binding.sensebox.internal.handler.SenseBoxHandler.publishData(SenseBoxHandler.java:146) ~[?:?]
        at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) ~[?:?]
        at java.util.concurrent.FutureTask.runAndReset(Unknown Source) ~[?:?]
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source) ~[?:?]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [?:?]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [?:?]
        at java.lang.Thread.run(Unknown Source) [?:?]
Caused by: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was NUMBER at line 1 column 4 path $
        at com.google.gson.stream.JsonReader.beginObject(JsonReader.java:385) ~[?:?]
        at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:213) ~[?:?]
        ... 17 more

Signed-off-by: Christoph Weitkamp github@christophweitkamp.de

Signed-off-by: Christoph Weitkamp <github@christophweitkamp.de>
@cweitkamp cweitkamp added the bug An unexpected problem or unintended behavior of an add-on label Mar 18, 2021
@cweitkamp cweitkamp requested a review from hakan42 as a code owner March 18, 2021 06:18
@wborn wborn added rebuild Triggers Jenkins PR build and removed rebuild Triggers Jenkins PR build labels Mar 18, 2021
Copy link
Member

@wborn wborn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@wborn wborn merged commit 0a2a6e7 into openhab:main Mar 26, 2021
@wborn wborn added this to the 3.1 milestone Mar 26, 2021
@cweitkamp cweitkamp deleted the bugfix-handle-jsonsyntaxexception branch March 26, 2021 17:27
themillhousegroup pushed a commit to themillhousegroup/openhab2-addons that referenced this pull request May 10, 2021
Signed-off-by: Christoph Weitkamp <github@christophweitkamp.de>
Signed-off-by: John Marshall <john.marshall.au@gmail.com>
computergeek1507 pushed a commit to computergeek1507/openhab-addons that referenced this pull request Jul 13, 2021
Signed-off-by: Christoph Weitkamp <github@christophweitkamp.de>
thinkingstone pushed a commit to thinkingstone/openhab-addons that referenced this pull request Nov 7, 2021
Signed-off-by: Christoph Weitkamp <github@christophweitkamp.de>
marcfischerboschio pushed a commit to bosch-io/openhab-addons that referenced this pull request May 5, 2022
Signed-off-by: Christoph Weitkamp <github@christophweitkamp.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An unexpected problem or unintended behavior of an add-on
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants