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

[Freeboxos] Fix NullPointerException when updating inactive Player #15813

Merged
merged 5 commits into from
Nov 4, 2023

Conversation

clinique
Copy link
Contributor

It can happen (when using webhooks) that a poll is sent when the player is not reachable.
This leads to an npe :

2023-10-27 08:35:00.680 [WARN ] [mmon.WrappedScheduledExecutorService] - Scheduled runnable ended with an exception: 
java.lang.IllegalArgumentException: path is null
	at org.apache.cxf.jaxrs.impl.UriBuilderImpl.doPath(UriBuilderImpl.java:549) ~[?:?]
	at org.apache.cxf.jaxrs.impl.UriBuilderImpl.path(UriBuilderImpl.java:544) ~[?:?]
	at org.openhab.binding.freeboxos.internal.api.rest.RestManager.buildUri(RestManager.java:59) ~[?:?]
	at org.openhab.binding.freeboxos.internal.api.rest.RestManager.get(RestManager.java:73) ~[?:?]
	at org.openhab.binding.freeboxos.internal.api.rest.RestManager.getSingle(RestManager.java:77) ~[?:?]
	at org.openhab.binding.freeboxos.internal.api.rest.PlayerManager.getPlayerStatus(PlayerManager.java:214) ~[?:?]
	at org.openhab.binding.freeboxos.internal.handler.ActivePlayerHandler.internalPoll(ActivePlayerHandler.java:71) ~[?:?]
	at org.openhab.binding.freeboxos.internal.handler.ApiConsumerHandler.handleCommand(ApiConsumerHandler.java:150) ~[?:?]
	at org.openhab.binding.freeboxos.internal.api.rest.WebSocketManager.lambda$1(WebSocketManager.java:112) ~[?:?]
	at java.util.HashMap$Values.forEach(HashMap.java:1065) ~[?:?]
	at org.openhab.binding.freeboxos.internal.api.rest.WebSocketManager.lambda$0(WebSocketManager.java:112) ~[?:?]
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539) ~[?:?]
	at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:305) ~[?:?]
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305) ~[?:?]
	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) [?:?]

Signed-off-by: clinique <[email protected]>
Signed-off-by: clinique <[email protected]>
Signed-off-by: clinique <[email protected]>
@jlaur jlaur added the bug An unexpected problem or unintended behavior of an add-on label Oct 27, 2023
Copy link
Contributor

@lsiepel lsiepel left a comment

Choose a reason for hiding this comment

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

LGTM

@lsiepel lsiepel requested a review from a team October 29, 2023 17:51
@clinique clinique self-assigned this Oct 30, 2023
@clinique clinique requested a review from lolodomo October 30, 2023 12:06
uptime = 0;
}
} else {
updateStatus(ThingStatus.OFFLINE);
Copy link
Contributor

Choose a reason for hiding this comment

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

It seems to be already done at line 74

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, you're correct

@@ -31,7 +31,6 @@
import org.openhab.core.thing.Thing;
import org.openhab.core.thing.ThingStatus;
import org.openhab.core.thing.binding.ThingHandlerService;
import org.slf4j.Logger;
Copy link
Contributor

Choose a reason for hiding this comment

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

Import to be restored

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

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 c7ce929 into openhab:main Nov 4, 2023
2 checks passed
@lolodomo lolodomo added this to the 4.1 milestone Nov 4, 2023
@clinique clinique deleted the freeboxos_npe_activeplayer branch November 4, 2023 09:29
@jlaur jlaur changed the title [Freeboxos] npe when updating inactive Player [Freeboxos] Fix NullPointerException when updating inactive Player Nov 4, 2023
andrewfg pushed a commit to andrewfg/openhab-addons that referenced this pull request Nov 26, 2023
* Correcting npe
* Added status update

---------

Signed-off-by: clinique <[email protected]>
austvik pushed a commit to austvik/openhab-addons that referenced this pull request Mar 27, 2024
* Correcting npe
* Added status update

---------

Signed-off-by: clinique <[email protected]>
Signed-off-by: Jørgen Austvik <[email protected]>
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.

4 participants