Review request for 7034570 - java.lang.Runtime.exec(String[] cmd, String[] env) can not work properly if SystemRoot not inherited

Ulf Zibis Ulf.Zibis at
Thu Apr 14 18:02:02 UTC 2011

Oops, SystemRoot could be null theoretically. So forget my comment about NUL termination.

But anyway, should we allow to have get("SystemRoot") != getEnv("SystemRoot")?

Is it correct to defaultly set the "SystemRoot" variable on non-Windows OS?

Why don't we inherit ProcessEnvironment from TreeMap, sorted by EntryComparator?
Then we would not need to sort it later.

 > The environment block is required to be sorted when you call CreateProcess() on Windows.
Shouldn't we handle this OS-dependent? There is no need to sort on non-Windows OS, and if, it should 
be case-sensitive.

ProcessEnvironment pe;
pe.put("systemroot", "C:\\WINDOWS");
String systemroot = pe.get("SYSTEMROOT");

systemroot would remain null!
So I ask, if we wouldn't better implement class ProcessEnvironment OS-dependent?


Am 14.04.2011 18:34, schrieb Ulf Zibis:
> You need not to ensure double NUL termination, because now sb.length() is always > 0.
> -Ulf
> Am 14.04.2011 16:06, schrieb Michael McMahon:
>> An updated webrev is available for this fix. I'll probably go ahead
>> with the CCC request for the spec. change anyway.
>> Thanks,
>> Michael.

More information about the core-libs-dev mailing list