[
https://issues.apache.org/jira/browse/CRYPTO-108?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15363962#comment-15363962
]
Sebb commented on CRYPTO-108:
-----------------------------
That's not what I meant. The static block currently does:
{code}
static {
String loadingFailure = null;
try {
if (Crypto.isNativeCodeLoaded()) {
OpenSslNative.initIDs();
}
} catch (Exception t) {
loadingFailure = t.getMessage();
} finally {
loadingFailureReason = loadingFailure;
}
}
{code}
Note that it ignores the condition isNativeLoaded == false, so OpenSslCipher
won't see the error
I think it should be:
{code}
static {
String loadingFailure = null;
try {
if (Crypto.isNativeCodeLoaded()) {
OpenSslNative.initIDs();
} else {
// Throwable cannot be null if isNativeCodeLoaded is false
loadingFailure = Crypto.getLoadingError().getMessage();
}
} catch (Exception t) {
loadingFailure = t.getMessage();
} finally {
loadingFailureReason = loadingFailure;
}
}
{code}
About throwing an error: I meant the class as a whole should throw the error,
not the static block.
e.g. in getInstance()
But at the least the static block should handle native load failure and update
the failure reason.
> OpenSSL does not handle Native code loading failure
> ---------------------------------------------------
>
> Key: CRYPTO-108
> URL: https://issues.apache.org/jira/browse/CRYPTO-108
> Project: Commons Crypto
> Issue Type: Bug
> Reporter: Sebb
>
> OpenSSL fails to check if the Native code was loaded successfully before
> creating an instance.
> This just defers the inevitable failure; it would be better to throw an error
> immediately.
> Also the code should provide the details of the load faiure
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)