[kaffe] String.indexOf bug

Kurt Miller truk at optonline.net
Wed Jul 13 15:24:26 PDT 2005


Using FreeBSD/i386 4.11 kaffe 1.1.5 from ports I'm seeing
a indexOf bug when the String is > 127 chars.

Note the -1 in the output below:
$ javac stringtest.java && java stringtest
124
124
-1
125

public class stringtest {
    private static String longString1 = "12345678901234567890123456789012345678901234567890123456789012345678
90123456789012345678901234567890123456789012345678901234END";
    private static String longString2 = "12345678901234567890123456789012345678901234567890123456789012345678
901234567890123456789012345678901234567890123456789012345END";

    public static void main(String[] args) {
        System.out.println( longString1.indexOf("END"));
        System.out.println( (new StringBuffer(longString1)).indexOf("END"));
        System.out.println( longString2.indexOf("END"));
        System.out.println( (new StringBuffer(longString2)).indexOf("END"));
    }
}






More information about the kaffe mailing list