mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 15:24:43 +02:00
8215281: Use String.isEmpty() when applicable in java.base
Reviewed-by: dfuchs, alanb
This commit is contained in:
parent
c998ead188
commit
a3df1d618e
155 changed files with 340 additions and 382 deletions
|
@ -75,7 +75,7 @@ public abstract class AbstractAlgorithmConstraints
|
|||
|
||||
static boolean checkAlgorithm(String[] algorithms, String algorithm,
|
||||
AlgorithmDecomposer decomposer) {
|
||||
if (algorithm == null || algorithm.length() == 0) {
|
||||
if (algorithm == null || algorithm.isEmpty()) {
|
||||
throw new IllegalArgumentException("No algorithm name specified");
|
||||
}
|
||||
|
||||
|
|
|
@ -80,7 +80,7 @@ public class AlgorithmDecomposer {
|
|||
* Please override the method if need to support more name pattern.
|
||||
*/
|
||||
public Set<String> decompose(String algorithm) {
|
||||
if (algorithm == null || algorithm.length() == 0) {
|
||||
if (algorithm == null || algorithm.isEmpty()) {
|
||||
return new HashSet<>();
|
||||
}
|
||||
|
||||
|
@ -167,7 +167,7 @@ public class AlgorithmDecomposer {
|
|||
* message digest algorithm name to avoid overly complicated checking.
|
||||
*/
|
||||
public static Set<String> decomposeOneHash(String algorithm) {
|
||||
if (algorithm == null || algorithm.length() == 0) {
|
||||
if (algorithm == null || algorithm.isEmpty()) {
|
||||
return new HashSet<>();
|
||||
}
|
||||
|
||||
|
|
|
@ -135,7 +135,7 @@ public class DisabledAlgorithmConstraints extends AbstractAlgorithmConstraints {
|
|||
public final boolean permits(Set<CryptoPrimitive> primitives,
|
||||
String algorithm, Key key, AlgorithmParameters parameters) {
|
||||
|
||||
if (algorithm == null || algorithm.length() == 0) {
|
||||
if (algorithm == null || algorithm.isEmpty()) {
|
||||
throw new IllegalArgumentException("No algorithm name specified");
|
||||
}
|
||||
|
||||
|
@ -188,7 +188,7 @@ public class DisabledAlgorithmConstraints extends AbstractAlgorithmConstraints {
|
|||
}
|
||||
|
||||
// check the signature algorithm with parameters
|
||||
if (algorithm != null && algorithm.length() != 0) {
|
||||
if (algorithm != null && !algorithm.isEmpty()) {
|
||||
if (!permits(primitives, algorithm, parameters)) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -423,7 +423,7 @@ public class SignatureFileVerifier {
|
|||
|
||||
// This means we have an error in finding weak algorithms, run in
|
||||
// debug mode to see permittedAlgs map's values.
|
||||
if (w.length() == 0) {
|
||||
if (w.isEmpty()) {
|
||||
return "Unknown Algorithm(s)";
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue