Fixes #2777 - Workaround for Conscrypt's ssl == null.

Isolated SSLEngine method calls and wrapped them into try/catch
blocks to ignore the NullPointerException thrown by Conscrypt.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
This commit is contained in:
Simone Bordet 2018-08-06 12:41:44 +02:00
parent 7845497702
commit da9c5fcae2
1 changed files with 43 additions and 5 deletions

View File

@ -705,7 +705,19 @@ public class SslConnection extends AbstractConnection
{
_sslEngine.closeInbound();
}
catch (SSLException x)
catch (Throwable x)
{
LOG.ignore(x);
}
}
private void closeOutbound()
{
try
{
_sslEngine.closeOutbound();
}
catch (Throwable x)
{
LOG.ignore(x);
}
@ -728,7 +740,7 @@ public class SslConnection extends AbstractConnection
{
if (_cannotAcceptMoreAppDataToFlush)
{
if (_sslEngine.isOutboundDone())
if (isOutboundDone())
throw new EofException(new ClosedChannelException());
return false;
}
@ -897,7 +909,7 @@ public class SslConnection extends AbstractConnection
{
try
{
_sslEngine.closeOutbound();
closeOutbound();
flush(BufferUtil.EMPTY_BUFFER); // Send close handshake
SslConnection.this.fillInterested(); // seek reply FIN or RST or close handshake
}
@ -912,7 +924,7 @@ public class SslConnection extends AbstractConnection
@Override
public boolean isOutputShutdown()
{
return _sslEngine.isOutboundDone() || getEndPoint().isOutputShutdown();
return isOutboundDone() || getEndPoint().isOutputShutdown();
}
@Override
@ -938,9 +950,35 @@ public class SslConnection extends AbstractConnection
@Override
public boolean isInputShutdown()
{
return isInboundDone();
}
private boolean isOutboundDone()
{
try
{
return _sslEngine.isOutboundDone();
}
catch (Throwable x)
{
LOG.ignore(x);
return true;
}
}
private boolean isInboundDone()
{
try
{
return _sslEngine.isInboundDone();
}
catch (Throwable x)
{
LOG.ignore(x);
return true;
}
}
@Override
public String toString()