Skip to content
This repository has been archived by the owner on May 17, 2021. It is now read-only.

Commit

Permalink
Catch number format exception in scene converter
Browse files Browse the repository at this point in the history
Signed-off-by: Chris Jackson <chris@cd-jackson.com>
  • Loading branch information
cdjackson committed Mar 18, 2016
1 parent ba61951 commit 0acee35
Showing 1 changed file with 15 additions and 4 deletions.
Expand Up @@ -69,17 +69,28 @@ SerialMessage executeRefresh(ZWaveNode node, ZWaveSceneActivationCommandClass co

@Override
void handleEvent(ZWaveCommandClassValueEvent event, Item item, Map<String, String> arguments) {
if (arguments.get("scene") == null) {
if (arguments.get("scene") == null || arguments.get("state") == null) {
logger.warn("NODE {}: Scene arguments not set scene={} state={}", event.getNodeId(), arguments.get("scene"),
arguments.get("state"));
return;
}

Integer scene = null;
Integer state = null;
try {
scene = Integer.parseInt(arguments.get("scene"));
state = Integer.parseInt(arguments.get("state"));
} catch (NumberFormatException e) {
logger.error("NODE {}: Number format exception {} {}", event.getNodeId(), arguments.get("scene"),
arguments.get("state"));
return;
}

int scene = Integer.parseInt(arguments.get("scene"));
if (scene != (Integer) event.getValue()) {
return;
}
Integer state = Integer.parseInt(arguments.get("state"));
ZWaveStateConverter<?, ?> converter = this.getStateConverter(item, state);

ZWaveStateConverter<?, ?> converter = this.getStateConverter(item, state);
if (converter == null) {
logger.warn("No converter found for item = {}, node = {} endpoint = {}, ignoring event.", item.getName(),
event.getNodeId(), event.getEndpoint());
Expand Down

0 comments on commit 0acee35

Please sign in to comment.