From 2d6ab72e3724b0f8780fc4801b6a8deb23017cfa Mon Sep 17 00:00:00 2001 From: Robert Michalak Date: Sun, 1 Dec 2024 14:55:32 +0100 Subject: [PATCH] [digiplex] Fix exception handling in sender and receiver threads Signed-off-by: Robert Michalak --- .../digiplex/internal/handler/DigiplexBridgeHandler.java | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/bundles/org.openhab.binding.digiplex/src/main/java/org/openhab/binding/digiplex/internal/handler/DigiplexBridgeHandler.java b/bundles/org.openhab.binding.digiplex/src/main/java/org/openhab/binding/digiplex/internal/handler/DigiplexBridgeHandler.java index f805eba944d1f..80fe4784d6305 100644 --- a/bundles/org.openhab.binding.digiplex/src/main/java/org/openhab/binding/digiplex/internal/handler/DigiplexBridgeHandler.java +++ b/bundles/org.openhab.binding.digiplex/src/main/java/org/openhab/binding/digiplex/internal/handler/DigiplexBridgeHandler.java @@ -320,8 +320,7 @@ public void run() { if (messagesSent.get() - responsesReceived.get() > STALLED_MESSAGES_THRESHOLD) { throw new IOException("PRT3 module is not responding!"); } - - } catch (IOException e) { + } catch (Exception e) { handleCommunicationError(); break; } @@ -369,11 +368,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");