private static MessageDigest getMessageDigest ( String digestType ) { MessageDigest messageDigest ; try { messageDigest = MessageDigest . getInstance ( digestType ) ; } catch ( NoSuchAlgorithmException e ) { //should not happen throw new RuntimeException ( e ) ; } return messageDigest ; }
this code replaces the creation of the message digest in a static code block as that was found to fail when multi threaded .