8194864: Outputs more details for PKCS11 tests if the NSS lib version cannot be determined
authorjjiang
Wed, 17 Jan 2018 18:34:50 -0800
changeset 48547 7537c762d42d
parent 48546 707438d2d171
child 48548 0dec8c41170c
8194864: Outputs more details for PKCS11 tests if the NSS lib version cannot be determined Summary: It outputs the lib content if the lib version cannot be parsed Reviewed-by: xuelei
test/jdk/ProblemList.txt
test/jdk/sun/security/pkcs11/PKCS11Test.java
--- a/test/jdk/ProblemList.txt	Wed Jan 17 18:26:05 2018 -0800
+++ b/test/jdk/ProblemList.txt	Wed Jan 17 18:34:50 2018 -0800
@@ -254,7 +254,6 @@
 # jdk_security
 
 sun/security/pkcs11/ec/TestKeyFactory.java                      8026976 generic-all
-sun/security/pkcs11/KeyStore/SecretKeysBasic.sh                 8186098 linux-all
 
 sun/security/tools/keytool/ListKeychainStore.sh                 8156889 macosx-all
 
--- a/test/jdk/sun/security/pkcs11/PKCS11Test.java	Wed Jan 17 18:26:05 2018 -0800
+++ b/test/jdk/sun/security/pkcs11/PKCS11Test.java	Wed Jan 17 18:34:50 2018 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2018, 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
@@ -443,7 +443,17 @@
 
         // the index after whitespace after nssHeader
         int afterheader = s.indexOf("NSS", i) + 4;
-        String version = s.substring(afterheader, s.indexOf(' ', afterheader));
+        int nextSpaceIndex = s.indexOf(' ', afterheader);
+
+        // If the next space is not found,
+        // it has to print the content for further investigation.
+        if (nextSpaceIndex == -1) {
+            System.out.println("===== Content start =====");
+            System.out.println(s);
+            System.out.println("===== Content end =====");
+        }
+
+        String version = s.substring(afterheader, nextSpaceIndex);
 
         // If a "dot dot" release, strip the extra dots for double parsing
         String[] dot = version.split("\\.");