[kaffe] BUG: StringBuffer.substring(...)
Mr Alex V Eustrop
eustrop@electronics.kiae.ru
Sun, 23 Jun 2002 22:13:05 +0400 (MSD)
java.lang.StringBuffer.substring(int start,int end)
defined since Sun JDK 1.2 dosn't work properly
1. Background:
java.lang.StringBuffer.substring(...) must be equal to
java.lang.StringBuffer.toString().substring(...)
but works strange
2. Test:
/*
* Kaffe 1.0.6/1.0.7-rc1 StringBuffer.substring() bug
*/
import java.util.*;
import java.io.*;
public class Tst {
public static void main(String[] args)
{
StringBuffer tst = new StringBuffer(
"# Comment\n%begin 123 \n\n\norg-id: 123\n");
System.err.println(1 + tst.substring(0,9));
System.err.println(2 + tst.substring(10,21));
System.err.println(3 + tst.substring(22,22));
System.err.println("--- end of output");
}
} // END OF Tst
3. Proper output (with sun jdk1.3.1):
1# Comment
2%begin 123
3
--- end of output
A
4. Kaffe 1.0.6/1.0.7-rc1 Output:
1# Comment
2%begin 123
org-id:
3
org-id: 123
--- end of output
5. Configuration
OS - FreeBSD 4.4-RELENG
kaffe 1.0.6 - from ports
or kaffe 1.0.7-rc1
--
Eustrop