[ https://issues.apache.org/jira/browse/NUTCH-3004?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17768682#comment-17768682 ]
ASF GitHub Bot commented on NUTCH-3004: --------------------------------------- tballison opened a new pull request, #778: URL: https://github.com/apache/nutch/pull/778 Thanks for your contribution to [Apache Nutch](https://nutch.apache.org/)! Your help is appreciated! Before opening the pull request, please verify that * there is an open issue on the [Nutch issue tracker](https://issues.apache.org/jira/projects/NUTCH) which describes the problem or the improvement. We cannot accept pull requests without an issue because the change wouldn't be listed in the release notes. * the issue ID (`NUTCH-XXXX`) - is referenced in the title of the pull request - and placed in front of your commit messages surrounded by square brackets (`[NUTCH-XXXX] Issue or pull request title`) * commits are squashed into a single one (or few commits for larger changes) * Java source code follows [Nutch Eclipse Code Formatting rules](https://github.com/apache/nutch/blob/master/eclipse-codeformat.xml) * Nutch is successfully built and unit tests pass by running `ant clean runtime test` * there should be no conflicts when merging the pull request branch into the *recent* master branch. If there are conflicts, please try to rebase the pull request branch on top of a freshly pulled master branch. * if new dependencies are added, - are these dependencies licensed in a way that is compatible for inclusion under [ASF 2.0](https://www.apache.org/legal/resolved.html#category-a)? - are `LICENSE-binary` and `NOTICE-binary` updated accordingly? We will be able to faster integrate your pull request if these conditions are met. If you have any questions how to fix your problem or about using Nutch in general, please sign up for the [Nutch mailing list](https://nutch.apache.org/mailing_lists.html). Thanks! > Avoid NPE in HttpResponse > ------------------------- > > Key: NUTCH-3004 > URL: https://issues.apache.org/jira/browse/NUTCH-3004 > Project: Nutch > Issue Type: Improvement > Reporter: Tim Allison > Priority: Trivial > > 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)