On Wed, 10 Feb 2021 12:24:15 GMT, Daniel Fuchs <dfu...@openjdk.org> wrote:
>> Fernando Guallini has updated the pull request incrementally with one >> additional commit since the last revision: >> >> narrow down connection reset handling > > test/jdk/javax/net/ssl/SSLSession/TestEnabledProtocols.java line 142: > >> 140: if ("Connection >> reset".equals(ssle.getCause().getMessage())) { >> 141: System.out.println("Client SSLException:"); >> 142: ssle.printStackTrace(System.out); > > An SSLException doesn't necessarily have a nested `cause` - so you could get > a NPE here. > I would suggest moving that code to a `private boolean > isConnectionReset(SSLException ssle)` method, and possibly checking the type > of the `cause` exception as well. I'm guessing it should be a > `SocketException`? > If you check the type then it will also exclude the case where the cause is > null and avoid the NPE. > Additional note: as a general rule, relying on exception message is fragile. > But since we don't have a specific subtype for "Connection reset" it's > probably the best we can do. Yes, added the verification to check if it is instanceof SocketException ------------- PR: https://git.openjdk.java.net/jdk/pull/2405