Fix NPE in OpenSslPrivateKeyMethodTest.destroy() when BoringSSL is not used

Motivation:

4079189f6b introduced OpenSslPrivateKeyMethodTest which will only be run when BoringSSL is used. As the assumeTrue(...) also guards the init of the static fields we need to ensure we only try to destroy these if BoringSSL is used as otherwise it will produce a NPE.

Modifications:

Check if BoringSSL is used before trying to destroy the resources.

Result:

No more NPE when BoringSSL is not used.
This commit is contained in:
Norman Maurer 2019-04-09 08:31:39 +02:00
parent ec21e575d7
commit c3c05e8570

View File

@ -106,10 +106,12 @@ public class OpenSslPrivateKeyMethodTest {
@AfterClass
public static void destroy() {
if (OpenSsl.isBoringSSL()) {
GROUP.shutdownGracefully();
CERT.delete();
EXECUTOR.shutdown();
}
}
private final boolean delegate;