code review request: 7174351: test/sun/security/tools/keytool/ failed after new Hashtable

Weijun Wang at
Tue Jun 5 07:52:30 PDT 2012

Hi Xuelei

Can you take a look at this?

In the test, I try to import a JCEKS keystore into a JKS one. The JCEKS 
one includes 4 entries:

    s1, Jun 5, 2012, SecretKeyEntry,
    s2, Jun 5, 2012, SecretKeyEntry,
    c1, Jun 5, 2012, trustedCertEntry,
    p1, Jun 5, 2012, PrivateKeyEntry,

Since you cannot store a SecretKeyEntry inside a JKS, there will be a 
warning like

    Entry for alias s1 not imported.
    Do you want to quit the import process? [no]:

If you enter "no" (or simply press ENTER) the import will go on with the 
next entry, with "yes", it terminates immediately.

So in the webrev you can see me calling the exact same commands twice. 
First give it "\n\n" to ignore warnings for both s1 and s2. Second give 
it a "yes\n" to terminate the import. Both should be consumed by the 
command correctly, and no keystroke is left in buffer.

However, the test has a bug that before the 2nd importstore, the x.jks 
file already exists. Before Mike introduced the new hash feature, it 
still works because s1 is always the first to import, so a single "yes" 
terminates the command nicely. Now, the order is random, and if you 
happen to see c1 comes first, another kind of prompt would show:

    Existing entry alias c1 exists, overwrite? [no]:

Here a single "yes" won't complete the command and the test fails.

Now I remove the x.jks before the 2nd call.


-------- Original Message --------
7174351: test/sun/security/tools/keytool/ failed after new 

=== *Description* 

test/sun/security/tools/keytool/ failed since 7118743 : 
Alternative Hashing for String with Hash-based Maps. The test mistakenly 
assumes a certain order of aliases in a keystore, stored in a Hashtable.

More information about the security-dev mailing list