diff --git a/jdk/test/java/security/SecureRandom/ApiTest.java b/jdk/test/java/security/SecureRandom/ApiTest.java index fb2e3558030..73fae8b8b21 100644 --- a/jdk/test/java/security/SecureRandom/ApiTest.java +++ b/jdk/test/java/security/SecureRandom/ApiTest.java @@ -195,10 +195,10 @@ public class ApiTest { case "AES-128": case "AES-192": case "AES-256": - int algoStrength = Integer.parseInt(alg.replaceAll("AES-", "")); - int maxStrengthSupported = Cipher.getMaxAllowedKeyLength("AES"); - if (strength > maxStrengthSupported - || algoStrength > maxStrengthSupported) { + int algoStrength = Integer.parseInt(alg.substring("AES-".length())); + int maxAESStrength = Cipher.getMaxAllowedKeyLength("AES"); + if (strength > algoStrength + || algoStrength > maxAESStrength) { error = false; } break;