[cp-patches] FYI: [generics] Fix for System.getenv bug

Archie Cobbs archie at dellroad.org
Sun Jun 4 16:07:46 UTC 2006

Andrew John Hughes wrote:
> I'm committing the patch which fixes a bug in System.getenv()
> when an environment variable has an empty value.

Not part of your patch (code was there before) but:

>  	    String[] parts = pair.split("=");

Shouldn't this be "pair.split("=", 1)" instead? E.g. what if I have
a variable like "FOO=2+2=4".

Actually, even that is not right. E.g., consider "FOO==BAR". The
value is "=BAR" not empty string.

Instead, I think using pair.indexOf('=') is required here...


Archie Cobbs      *        CTO, Awarix        *      http://www.awarix.com

More information about the Classpath-patches mailing list