equal
deleted
inserted
replaced
235 */ |
235 */ |
236 public static MessageDigest getInstance(String algorithm, String provider) |
236 public static MessageDigest getInstance(String algorithm, String provider) |
237 throws NoSuchAlgorithmException, NoSuchProviderException |
237 throws NoSuchAlgorithmException, NoSuchProviderException |
238 { |
238 { |
239 Objects.requireNonNull(algorithm, "null algorithm name"); |
239 Objects.requireNonNull(algorithm, "null algorithm name"); |
240 if (provider == null || provider.length() == 0) |
240 if (provider == null || provider.isEmpty()) |
241 throw new IllegalArgumentException("missing provider"); |
241 throw new IllegalArgumentException("missing provider"); |
242 Object[] objs = Security.getImpl(algorithm, "MessageDigest", provider); |
242 Object[] objs = Security.getImpl(algorithm, "MessageDigest", provider); |
243 if (objs[0] instanceof MessageDigest) { |
243 if (objs[0] instanceof MessageDigest) { |
244 MessageDigest md = (MessageDigest)objs[0]; |
244 MessageDigest md = (MessageDigest)objs[0]; |
245 md.provider = (Provider)objs[1]; |
245 md.provider = (Provider)objs[1]; |