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
--- 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("\\.");