提交 7a8bf6a8 编写于 作者: W weijun

6868867: Test: sun/security/tools/keytool/standard.sh fails under windows/cygwin

Reviewed-by: wetmore
上级 4eb3d578
...@@ -880,14 +880,19 @@ public final class KeyTool { ...@@ -880,14 +880,19 @@ public final class KeyTool {
// might not work properly, since -gencert is slow // might not work properly, since -gencert is slow
// and there's no data in the pipe at the beginning. // and there's no data in the pipe at the beginning.
ByteArrayOutputStream bout = new ByteArrayOutputStream(); ByteArrayOutputStream bout = new ByteArrayOutputStream();
try {
byte[] b = new byte[4096]; byte[] b = new byte[4096];
while (true) { while (true) {
int len = inStream.read(b); int len = inStream.read(b);
if (len < 0) break; if (len < 0) break;
bout.write(b, 0, len); bout.write(b, 0, len);
} }
} finally {
if (inStream != System.in) {
inStream.close();
}
}
inStream = new ByteArrayInputStream(bout.toByteArray()); inStream = new ByteArrayInputStream(bout.toByteArray());
try {
String importAlias = (alias!=null)?alias:keyAlias; String importAlias = (alias!=null)?alias:keyAlias;
if (keyStore.entryInstanceOf(importAlias, KeyStore.PrivateKeyEntry.class)) { if (keyStore.entryInstanceOf(importAlias, KeyStore.PrivateKeyEntry.class)) {
kssave = installReply(importAlias, inStream); kssave = installReply(importAlias, inStream);
...@@ -910,11 +915,6 @@ public final class KeyTool { ...@@ -910,11 +915,6 @@ public final class KeyTool {
("Certificate was not added to keystore")); ("Certificate was not added to keystore"));
} }
} }
} finally {
if (inStream != System.in) {
inStream.close();
}
}
} else if (command == IMPORTKEYSTORE) { } else if (command == IMPORTKEYSTORE) {
doImportKeyStore(); doImportKeyStore();
kssave = true; kssave = true;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册