[squeezebox] Fix NumberFormatException when parsing status message (#13010)
* Fix NumberFormatException when parsing status message Signed-off-by: Mark Hilbush <mark@hilbush.com>
This commit is contained in:
parent
1a557fe17c
commit
7e151e8fce
|
@ -680,6 +680,7 @@ public class SqueezeBoxServerHandler extends BaseBridgeHandler {
|
||||||
String artworkUrl = null;
|
String artworkUrl = null;
|
||||||
|
|
||||||
for (KeyValue entry : decodeKeyValueResponse(messageParts)) {
|
for (KeyValue entry : decodeKeyValueResponse(messageParts)) {
|
||||||
|
try {
|
||||||
// Parameter Power
|
// Parameter Power
|
||||||
if ("power".equals(entry.key)) {
|
if ("power".equals(entry.key)) {
|
||||||
final boolean power = "1".equals(entry.value);
|
final boolean power = "1".equals(entry.value);
|
||||||
|
@ -695,7 +696,7 @@ public class SqueezeBoxServerHandler extends BaseBridgeHandler {
|
||||||
updatePlayer(listener -> listener.modeChangeEvent(mac, entry.value));
|
updatePlayer(listener -> listener.modeChangeEvent(mac, entry.value));
|
||||||
}
|
}
|
||||||
// Parameter Playing Time
|
// Parameter Playing Time
|
||||||
else if ("time".equals(entry.key)) {
|
else if ("time".equals(entry.key) && !"N/A".equals(entry.value)) {
|
||||||
final int time = (int) Double.parseDouble(entry.value);
|
final int time = (int) Double.parseDouble(entry.value);
|
||||||
updatePlayer(listener -> listener.currentPlayingTimeEvent(mac, time));
|
updatePlayer(listener -> listener.currentPlayingTimeEvent(mac, time));
|
||||||
}
|
}
|
||||||
|
@ -763,6 +764,10 @@ public class SqueezeBoxServerHandler extends BaseBridgeHandler {
|
||||||
// Added to be able to see additional status message types
|
// Added to be able to see additional status message types
|
||||||
logger.trace("Unhandled status message type '{}' (value '{}')", entry.key, entry.value);
|
logger.trace("Unhandled status message type '{}' (value '{}')", entry.key, entry.value);
|
||||||
}
|
}
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
// Skip this key/value
|
||||||
|
logger.debug("Cannot parse number in status message: key '{}', value '{}'", entry.key, entry.value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
final String finalUrl = constructCoverArtUrl(mac, coverart, coverid, artworkUrl);
|
final String finalUrl = constructCoverArtUrl(mac, coverart, coverid, artworkUrl);
|
||||||
|
|
Loading…
Reference in New Issue