changeset 42329:c964d4aca91a

8170247: java/security/SecureRandom/ApiTest fails when run with unlimited policy Summary: Test was failing to handle expected exception in case of unlimited policy Reviewed-by: weijun
author ssahoo
date Wed, 30 Nov 2016 03:49:55 -0800
parents d7a6e1a824bc
children bd999576b78d
files jdk/test/java/security/SecureRandom/ApiTest.java
diffstat 1 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/jdk/test/java/security/SecureRandom/ApiTest.java	Tue Nov 29 19:02:53 2016 -0800
+++ b/jdk/test/java/security/SecureRandom/ApiTest.java	Wed Nov 30 03:49:55 2016 -0800
@@ -195,10 +195,10 @@
             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;