openBA-NextGenTV / OpenBA-NextGenTV

MIT License
15 stars 8 forks source link

Malformed JSON response from WebSocket crashes BA #4

Open mgatc opened 2 years ago

mgatc commented 2 years ago

While testing on my computer with the mockServer, everything seems to work fine. When trying on receivers, however, it doesn't seem to show anything. On the one receiver that I can access the BA through the web browser, I see the receiver websocket server returns an empty string for the baseURI query. Then, openBA tries to parse the empty string as JSON, which it can't, throwing an exception. The exception is caught but then rethrown, crashing the BA.

This logic applies to any websocket message the BA receives, not just the baseURI response. I wouldn't expect something like this to completely crash the BA, which could still have some utility despite a single websocket query failing as such.

For the sake of thoroughness, I'll note that I have also reached out to the receiver manufacturer about correcting the invalid response.

Thanks for any assistance you can provide and thank you for open-sourcing this!

Mjxa commented 2 years ago

Hello @mgatc In this PR crash is fixed, and also added ErrorBoundary for ws errors. Anyway, at this moment BA will hide if any errors from ws are happening.