From b4b2fecb42d9f14d73e8d79a9e59dee4d697f9cf Mon Sep 17 00:00:00 2001 From: Justin Lu Date: Mon, 28 Aug 2023 20:36:32 +0000 Subject: [PATCH] 8311081: KeytoolReaderP12Test.java fail on localized Windows platform Reviewed-by: lancea, jpai, weijun --- test/jdk/java/security/KeyStore/PKCS12/Utils.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/test/jdk/java/security/KeyStore/PKCS12/Utils.java b/test/jdk/java/security/KeyStore/PKCS12/Utils.java index 67286bd8bea..22131390d06 100644 --- a/test/jdk/java/security/KeyStore/PKCS12/Utils.java +++ b/test/jdk/java/security/KeyStore/PKCS12/Utils.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2023, 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 @@ -59,11 +59,14 @@ public class Utils { public static OutputAnalyzer executeKeytoolCommand(String[] command, int exitCode) { - String[] keytoolCmd = new String[command.length + 1]; + String[] keytoolCmd = new String[command.length + 3]; OutputAnalyzer output = null; try { keytoolCmd[0] = JDKToolFinder.getJDKTool(KEYTOOL); - System.arraycopy(command, 0, keytoolCmd, 1, command.length); + // Ensure the keytool process is always ran under English locale + keytoolCmd[1] = "-J-Duser.language=en"; + keytoolCmd[2] = "-J-Duser.country=US"; + System.arraycopy(command, 0, keytoolCmd, 3, command.length); output = ProcessTools.executeCommand(keytoolCmd); output.shouldHaveExitValue(exitCode); out.println("Executed keytool command sucessfully:"