private static AlgorithmException wrapException ( Throwable throwable ) { if ( throwable == null ) { return null ; } else if ( throwable instanceof AlgorithmException ) { return ( AlgorithmException ) throwable ; } else { return new AlgorithmException ( throwable . getMessage ( ) , wrapException ( throwable . getCause ( ) ) , wrapStackTrace ( throwable ) ) ; } }
Constructs a new algorithm exception from an existing throwable . This replaces all Exceptions in the cause hierarchy to be replaced with AlgorithmException for inter - jvm communication safety .