Skip to content

Commit 37d910d

Browse files
authored
Catch ISE (openhab#17854)
Signed-off-by: Leo Siepel <[email protected]>
1 parent 5d89c9a commit 37d910d

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

bundles/org.openhab.binding.dsmr/src/main/java/org/openhab/binding/dsmr/internal/device/connector/DSMRErrorStatus.java

+4
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@ public enum DSMRErrorStatus {
4444
* Serial port doesn't support the configured settings.
4545
*/
4646
PORT_NOT_COMPATIBLE(true),
47+
/**
48+
* Serial port time out or illegal state.
49+
*/
50+
PORT_PORT_TIMEOUT(false),
4751
/**
4852
* Reading data from the serial port failed.
4953
*/

bundles/org.openhab.binding.dsmr/src/main/java/org/openhab/binding/dsmr/internal/device/connector/DSMRSerialConnector.java

+4
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,10 @@ public void open(final DSMRSerialSettings portSettings) {
172172
logger.warn("Possible bug because a new serial port value was set during opening new port.");
173173
errorStatus = DSMRErrorStatus.PORT_INTERNAL_ERROR;
174174
}
175+
} catch (final IllegalStateException ise) {
176+
logger.debug("Failed communicating, probably time out", ise);
177+
178+
errorStatus = DSMRErrorStatus.PORT_PORT_TIMEOUT;
175179
} catch (final IOException ioe) {
176180
logger.debug("Failed to get inputstream for serialPort", ioe);
177181

0 commit comments

Comments
 (0)