From 519dc0c3f9be97af23716e044f195abd81b9b4b3 Mon Sep 17 00:00:00 2001 From: Alan Bateman Date: Thu, 7 Jun 2012 18:42:47 +0100 Subject: [PATCH] 7174723: TEST_BUG: java/lang/ProcessBuilder/Basic.java failing [win] Reviewed-by: mduigou --- jdk/test/java/lang/ProcessBuilder/Basic.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/jdk/test/java/lang/ProcessBuilder/Basic.java b/jdk/test/java/lang/ProcessBuilder/Basic.java index b3aa3087495..b18a0f66ca2 100644 --- a/jdk/test/java/lang/ProcessBuilder/Basic.java +++ b/jdk/test/java/lang/ProcessBuilder/Basic.java @@ -248,6 +248,7 @@ public class Basic { private static String getenvAsString(Map environment) { StringBuilder sb = new StringBuilder(); + environment = new TreeMap<>(environment); for (Map.Entry e : environment.entrySet()) // Ignore magic environment variables added by the launcher if (! e.getKey().equals("NLSPATH") && @@ -1625,7 +1626,7 @@ public class Basic { childArgs.add("System.getenv()"); String[] cmdp = childArgs.toArray(new String[childArgs.size()]); String[] envp; - String[] envpWin = {"=ExitValue=3", "=C:=\\", "SystemRoot="+systemRoot}; + String[] envpWin = {"=C:=\\", "=ExitValue=3", "SystemRoot="+systemRoot}; String[] envpOth = {"=ExitValue=3", "=C:=\\"}; if (Windows.is()) { envp = envpWin; @@ -1633,7 +1634,7 @@ public class Basic { envp = envpOth; } Process p = Runtime.getRuntime().exec(cmdp, envp); - String expected = Windows.is() ? "=C:=\\,SystemRoot="+systemRoot+",=ExitValue=3," : "=C:=\\,"; + String expected = Windows.is() ? "=C:=\\,=ExitValue=3,SystemRoot="+systemRoot+"," : "=C:=\\,"; String commandOutput = commandOutput(p); if (MacOSX.is()) { commandOutput = removeMacExpectedVars(commandOutput); @@ -1690,7 +1691,7 @@ public class Basic { commandOutput = removeMacExpectedVars(commandOutput); } check(commandOutput.equals(Windows.is() - ? "SystemRoot="+systemRoot+",LC_ALL=C," + ? "LC_ALL=C,SystemRoot="+systemRoot+"," : "LC_ALL=C,"), "Incorrect handling of envstrings containing NULs"); } catch (Throwable t) { unexpected(t); }