Review request for 7034570
michael.x.mcmahon at oracle.com
Wed Apr 13 14:26:29 UTC 2011
David Holmes wrote:
> Spec change seems fine to me.
> Is it possible to watch for the SystemRoot entry while iterating
> through at line 322 (ProcessEnvironment.java) instead of doing the
> iterative search before-hand? Or even doing the sort first and then a
> binary-search? Maybe the environment on windows is small enough that
> this isn't an issue?
Originally, I thought that wouldn't work due to the case-insensitivity
of the names. You could get
the name as "SYSTEMROOT" or "SysTeMRoOt" for example. But, thinking
about it again,
I could compareToIgnoreCase() with whatever variant is
lexicographically last ( "systemroot" I think)
and considering the list is already sorted, if we encounter a name that
is greater than "systemroot",
we know it's not there. It's still the same number of comparisons, but
only one loop.
> Also what if the parent process doesn't have SystemRoot set in its
> environment? Does the child just get a 'null' entry?
Yes, it's probably better not to set it at all, in the event that
SystemRoot is not set in the parent.
More information about the core-libs-dev