From 4b51608dc57a888ed2dedd26b2010370bc744404 Mon Sep 17 00:00:00 2001 From: Sami Salonen Date: Thu, 29 Apr 2021 18:53:48 +0300 Subject: [PATCH] Do not obfuscate error messages Signed-off-by: Sami Salonen --- src/main/java/net/wimpi/modbus/io/ModbusRTUTransport.java | 2 +- src/main/java/net/wimpi/modbus/io/ModbusTCPTransport.java | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/net/wimpi/modbus/io/ModbusRTUTransport.java b/src/main/java/net/wimpi/modbus/io/ModbusRTUTransport.java index 6bfadb6..4b74a43 100755 --- a/src/main/java/net/wimpi/modbus/io/ModbusRTUTransport.java +++ b/src/main/java/net/wimpi/modbus/io/ModbusRTUTransport.java @@ -311,7 +311,7 @@ private void getResponse(int fn, BytesOutputStream out) throws IOException { } } catch (IOException e) { m_CommPort.disableReceiveThreshold(); - throw new IOException("getResponse serial port exception"); + throw e; } }// getResponse diff --git a/src/main/java/net/wimpi/modbus/io/ModbusTCPTransport.java b/src/main/java/net/wimpi/modbus/io/ModbusTCPTransport.java index c43eef3..12e7453 100755 --- a/src/main/java/net/wimpi/modbus/io/ModbusTCPTransport.java +++ b/src/main/java/net/wimpi/modbus/io/ModbusTCPTransport.java @@ -176,7 +176,8 @@ public ModbusRequest readRequest() throws ModbusIOException { throw new ModbusIOException(true); } catch (Exception ex) { // ex.printStackTrace(); - throw new ModbusIOException("I/O exception - failed to read."); + throw new ModbusIOException(String.format("I/O exception - failed to read: %s %s", + ex.getClass().getSimpleName(), ex.getMessage())); } }// readRequest