Le 28/01/16 15:37, Jon V. a écrit :
> Sorry, I hit enter and my email sent.
>
> IoFilterChain filterChain = session.getFilterChain();
>
> if (filterChain == null) {
> throw new SSLException("No filter chain");
> }
>
>
> This isn’t necessary. I think we need to know more about OPs goals before
> adding hacky workarounds.
Hmm, yeah, it's probably over-protective.
With respect to such check, I should first have added a if (session ==
null), and not having such a check makes teh second check a bit spurious.
We can drop it and only have :
public void initiateHandshake(IoSession session) throws SSLException {
IoFilter.NextFilter nextFilter =
session.getFilterChain().getNextFilter(SslFilter.class);
if (nextFilter == null) {
throw new SSLException("No SSL next filter in the chain");
}
initiateHandshake(nextFilter, session);
}
For teh same reason, I don't see any use case where we can't have a
nextFilter, so the if (nextFilter == null) is also spurious.
I may have been hit too many times by pervasive NPE, and I try to catch
them before they happen...