Bug in Boolean constructor

Stephen Summerfield stephen at netality.com
Sat Nov 21 10:23:47 PST 1998


I discovered a bug in Kaffe 1.0.b2, in the java.lang.Boolean
constructor.
The following program shows the problem:

public class TestBoolean {

public static void main( String[] args ) {
	System.out.println( "new Boolean(\"false\")=" + new
Boolean("false") );
	System.out.println( "new Boolean(\"true\")=" + new
Boolean("true") );
}
}

The result is true in both cases, instead of false and true.

The fix is as follows:

public Boolean(String s)
	{
	//if (s != null || s.equals("true")) {
	if (s != null && s.equals("true")) {  //<-- Changed to this
		value = true;
	}
	else {
		value = false;
	}
}

btw What's the 'official' channel for reporting bugs?

Steve

Stephen Summerfield
Netality Ltd, London
stephen at netality.com


More information about the kaffe mailing list