[ https://issues.apache.org/jira/browse/NUTCH-3004?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Sebastian Nagel updated NUTCH-3004: ----------------------------------- Fix Version/s: 1.20 > Avoid NPE in HttpResponse > ------------------------- > > Key: NUTCH-3004 > URL: https://issues.apache.org/jira/browse/NUTCH-3004 > Project: Nutch > Issue Type: Improvement > Affects Versions: 1.19 > Reporter: Tim Allison > Priority: Trivial > Fix For: 1.20 > > > I recently deployed nutch on a FIPS enabled rhel 8 instance, and I got an NPE > in HttpResponse. When I set the log level to debug, I could see what was > happening, but it would have been better to get a meaningful exception rather > than an NPE. > The issue is that in the catch clause, the exception is propagated only if > the message is "handshake alert..." and then the reconnect fails. If the > message is not that, then the ssl socket remains null, and we get an NPE > below the source I quote here. > I think we should throw the same HTTPException that we do throw in the nested > try if the message is not "handshake alert..." > {code:java} > try { > sslsocket = getSSLSocket(socket, sockHost, sockPort); > sslsocket.startHandshake(); > } catch (Exception e) { > Http.LOG.debug("SSL connection to {} failed with: {}", url, > e.getMessage()); > if ("handshake alert: unrecognized_name".equals(e.getMessage())) { > try { > // Reconnect, see NUTCH-2447 > socket = new Socket(); > socket.setSoTimeout(http.getTimeout()); > socket.connect(sockAddr, http.getTimeout()); > sslsocket = getSSLSocket(socket, "", sockPort); > sslsocket.startHandshake(); > } catch (Exception ex) { > String msg = "SSL reconnect to " + url + " failed with: " > + e.getMessage(); > throw new HttpException(msg); > } > } > } > socket = sslsocket; > } > {code} -- This message was sent by Atlassian Jira (v8.20.10#820010)