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

[vigicrues] Fix NullPointerException when API does not provide station details #15832

Merged
merged 1 commit into from
Nov 3, 2023

Conversation

clinique
Copy link
Contributor

@clinique clinique commented Nov 1, 2023

2023-11-01 18:01:35.424 [ERROR] [nal.common.AbstractInvocationHandler] - An error occurred while calling method 'ThingHandler.initialize()' on 'org.openhab.binding.vigicrues.internal.handler.VigiCruesHandler@55e3d5fd': Cannot invoke "java.util.List.stream()" because "stationDetails.stations" is null
java.lang.NullPointerException: Cannot invoke "java.util.List.stream()" because "stationDetails.stations" is null
	at org.openhab.binding.vigicrues.internal.handler.VigiCruesHandler.discoverAttributes(VigiCruesHandler.java:132) ~[?:?]
	at org.openhab.binding.vigicrues.internal.handler.VigiCruesHandler.initialize(VigiCruesHandler.java:99) ~[?:?]
	at jdk.internal.reflect.GeneratedMethodAccessor37.invoke(Unknown Source) ~[?:?]
	at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
	at java.lang.reflect.Method.invoke(Method.java:568) ~[?:?]
	at org.openhab.core.internal.common.AbstractInvocationHandler.invokeDirect(AbstractInvocationHandler.java:147) [bundleFile:?]
	at org.openhab.core.internal.common.Invocation.call(Invocation.java:52) [bundleFile:?]
	at java.util.concurrent.FutureTask.run(FutureTask.java:264) [?:?]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) [?:?]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) [?:?]
	at java.lang.Thread.run(Thread.java:840) [?:?]

Avoids NPE if no station provided by API

Signed-off-by: clinique <gael@lhopital.org>
@clinique clinique added the bug An unexpected problem or unintended behavior of an add-on label Nov 1, 2023
@clinique clinique self-assigned this Nov 1, 2023
@lolodomo lolodomo added rebuild Triggers Jenkins PR build and removed rebuild Triggers Jenkins PR build labels Nov 3, 2023
Copy link
Contributor

@lolodomo lolodomo left a comment

Choose a reason for hiding this comment

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

LGTM, thank you

@lolodomo lolodomo merged commit 15a673a into openhab:main Nov 3, 2023
2 checks passed
@lolodomo lolodomo added this to the 4.1 milestone Nov 3, 2023
@clinique clinique deleted the vigicrues_npe branch November 4, 2023 09:08
@jlaur jlaur changed the title [vigicrues] NPE when API does not provide station details [vigicrues] Fix NullPointerException when API does not provide station details Nov 4, 2023
andrewfg pushed a commit to andrewfg/openhab-addons that referenced this pull request Nov 26, 2023
Signed-off-by: clinique <gael@lhopital.org>
austvik pushed a commit to austvik/openhab-addons that referenced this pull request Mar 27, 2024
Signed-off-by: clinique <gael@lhopital.org>
Signed-off-by: Jørgen Austvik <jaustvik@acm.org>
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