[GitHub] JulianFeinauer commented on a change in pull request #10: Fixed NPE in S7PlcConnection#close.
JulianFeinauer commented on a change in pull request #10: Fixed NPE in S7PlcConnection#close. URL: https://github.com/apache/incubator-plc4x/pull/10#discussion_r207200954 ## File path: plc4j/protocols/s7/src/test/java/org/apache/plc4x/java/s7/connection/S7PlcConnectionIT.java ## @@ -58,7 +58,12 @@ public void setUp() { @After public void tearDown() { if(s7PlcConnection.isConnected()) { -s7PlcConnection.close(); +try { +s7PlcConnection.close(); +} catch (NullPointerException e) { Review comment: @chrisdutz how is your setup? For me, this removed the exception here for me with my S7. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] JulianFeinauer commented on a change in pull request #10: Fixed NPE in S7PlcConnection#close.
JulianFeinauer commented on a change in pull request #10: Fixed NPE in S7PlcConnection#close. URL: https://github.com/apache/incubator-plc4x/pull/10#discussion_r207178132 ## File path: plc4j/protocols/s7/src/main/java/org/apache/plc4x/java/s7/connection/S7PlcConnection.java ## @@ -183,14 +194,19 @@ public void close() { (short) 0x, (short) 0x000F, DisconnectReason.NORMAL, Collections.emptyList(), null); ChannelFuture sendDisconnectRequestFuture = channel.writeAndFlush(disconnectRequest); -sendDisconnectRequestFuture.addListener((ChannelFutureListener) future -> { -// Close the session itself. -channel.closeFuture().await(); +// Wait if the PLC closes the connection +try { +// TODO 02.08.18 jf: Do we have global constants for things like timeouts? Review comment: fixed and removed todo. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services