8323624: ProviderList.ServiceList does not need to be a list

Reviewed-by: mullan
This commit is contained in:
Weijun Wang 2024-03-29 15:23:26 +00:00
parent 418deaf5a1
commit 59c2aff1ed
12 changed files with 70 additions and 131 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -177,9 +177,8 @@ public class Mac implements Cloneable {
public static final Mac getInstance(String algorithm)
throws NoSuchAlgorithmException {
Objects.requireNonNull(algorithm, "null algorithm name");
List<Service> services = GetInstance.getServices("Mac", algorithm);
// make sure there is at least one service from a signed provider
Iterator<Service> t = services.iterator();
Iterator<Service> t = GetInstance.getServices("Mac", algorithm);
while (t.hasNext()) {
Service s = t.next();
if (!JceSecurity.canUseProvider(s.getProvider())) {