You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Xianda Ke (JIRA)" <ji...@apache.org> on 2016/07/06 07:31:11 UTC

[jira] [Commented] (CRYPTO-108) OpenSSL does not handle Native code loading failure

    [ https://issues.apache.org/jira/browse/CRYPTO-108?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15363906#comment-15363906 ] 

Xianda Ke commented on CRYPTO-108:
----------------------------------

[~sebb@apache.org], 
Currently, OpenSSL doesn't throw exception. the native is loaded in a static block.
Class initializers are executed in the order they are defined, if we throw exception when loading native in the static block. we are trying to use a class that is in an erroneous state.

if any loading failure, OpenSslCipher.java will handle it and throw an exception.
{code}
OpenSslCipher(Properties props, String transformation) {
        //...
        String loadingFailureReason = OpenSsl.getLoadingFailureReason();
        if (loadingFailureReason != null) {
            throw new RuntimeException(loadingFailureReason);
        }
}
{code}



> 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)