Objects#requireNonNull guard in MessageDigests

This commit is contained in:
Jason Tedor 2016-02-07 11:20:53 -05:00
parent d0c03b26f6
commit 16fe948a15
1 changed files with 2 additions and 3 deletions

View File

@ -23,6 +23,7 @@ import org.elasticsearch.ElasticsearchException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.Objects;
public class MessageDigests {
@ -61,9 +62,7 @@ public class MessageDigests {
private static final char[] HEX_DIGITS = "0123456789abcdef".toCharArray();
public static String toHexString(byte[] bytes) {
if (bytes == null) {
throw new NullPointerException("bytes");
}
Objects.requireNonNull(bytes);
StringBuilder sb = new StringBuilder(2 * bytes.length);
for (int i = 0; i < bytes.length; i++) {