Skip to content

Commit

Permalink
[digiplex] Fix exception handling in sender and receiver threads
Browse files Browse the repository at this point in the history
Signed-off-by: Robert Michalak <[email protected]>
  • Loading branch information
rmichalak committed Dec 1, 2024
1 parent 3a798b5 commit b9cbdec
Showing 1 changed file with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -320,8 +320,9 @@ public void run() {
if (messagesSent.get() - responsesReceived.get() > STALLED_MESSAGES_THRESHOLD) {
throw new IOException("PRT3 module is not responding!");
}

} catch (IOException e) {
} catch (InterruptedException e) {

Check failure on line 323 in bundles/org.openhab.binding.digiplex/src/main/java/org/openhab/binding/digiplex/internal/handler/DigiplexBridgeHandler.java

View workflow job for this annotation

GitHub Actions / Build (Java 17, ubuntu-24.04)

Unreachable catch block for java.lang.InterruptedException. This exception is never thrown from the try statement body
break;
} catch (Exception e) {
handleCommunicationError();
break;
}
Expand Down Expand Up @@ -369,11 +370,11 @@ public void run() {
updateState(BRIDGE_MESSAGES_SENT, new DecimalType(messagesSent.incrementAndGet()));
logger.debug("message sent: '{}'", request.getSerialMessage().replace("\r", ""));
Thread.sleep(SLEEP_TIME); // do not flood PRT3 with messages as it creates unpredictable responses
} catch (IOException e) {
handleCommunicationError();
break;
} catch (InterruptedException e) {
break;
} catch (Exception e) {
handleCommunicationError();
break;
}
}
logger.debug("Sender thread finished");
Expand Down

0 comments on commit b9cbdec

Please sign in to comment.