-
Bug
-
Resolution: Duplicate
-
P2
-
None
-
1.4.0
-
generic
-
generic
Name: skR10005 Date: 04/14/2001
The JCK-merlin test
api/java_lang/StringBuffer/index.html#append[StringBuffer0023]
fails since jdk-merlin-b54 in sameJVM mode.
To reproduce this bug the following short example can be used:
=============================================================
public class A {
public static void main(String argv[]) {
System.out.println(new A().StringBuffer0023());
}
public String StringBuffer0023() {
int failed = 0;
StringBuffer sb;
char str[] = {'a', 'b', 'c', 'd'};
for(int q = 0; q < 2; q++) {
for (int i = -10; i < str.length + 10; i++) {
for (int j = -10; j < str.length + 10; j++) {
sb = new StringBuffer("this is a test string");
if (i < 0 || j < 0 || (i + j) > str.length) {
try {
sb.append(str, i, j);
failed ++;
System.out.println("IndexOutOfBoundsException not
thrown with "
+ i + " and " + j + " String:" + sb);
} catch(IndexOutOfBoundsException e) {
}
}
}
}
}
if (failed > 0) {
return "FAILED";
} else {
return "OKAY";
}
}
}
=============================================================
log:
$java -version
java version "1.4.0-beta"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-beta-b54)
Java HotSpot(TM) Client VM (build 1.4beta-B54, mixed mode)
$java -cp . A
IndexOutOfBoundsException not thrown with 9 and -9 String:this is a te
IndexOutOfBoundsException not thrown with 9 and -8 String:this is a tes
IndexOutOfBoundsException not thrown with 9 and -7 String:this is a test
IndexOutOfBoundsException not thrown with 9 and -6 String:this is a test
IndexOutOfBoundsException not thrown with 9 and -5 String:this is a test s
IndexOutOfBoundsException not thrown with 10 and -10 String:this is a t
IndexOutOfBoundsException not thrown with 10 and -9 String:this is a te
IndexOutOfBoundsException not thrown with 10 and -8 String:this is a tes
IndexOutOfBoundsException not thrown with 10 and -7 String:this is a test
IndexOutOfBoundsException not thrown with 10 and -6 String:this is a test
IndexOutOfBoundsException not thrown with 11 and -10 String:this is a t
IndexOutOfBoundsException not thrown with 11 and -9 String:this is a te
IndexOutOfBoundsException not thrown with 11 and -8 String:this is a tes
IndexOutOfBoundsException not thrown with 11 and -7 String:this is a test
IndexOutOfBoundsException not thrown with 12 and -10 String:this is a t
IndexOutOfBoundsException not thrown with 12 and -9 String:this is a te
IndexOutOfBoundsException not thrown with 12 and -8 String:this is a tes
IndexOutOfBoundsException not thrown with 13 and -10 String:this is a t
IndexOutOfBoundsException not thrown with 13 and -9 String:this is a te
FAILED
Note, that removing loop with index variable q results in test is passed.
======================================================================