-
Bug
-
Resolution: Fixed
-
P4
-
1.2.2
-
beta
-
generic
-
generic
Name: jk109818 Date: 07/27/2000
Many tried with same results:
On Solaris 2.7:
java version "1.2"
Classic VM (build JDK-1.2-V, green threads, sunwjit)
java version "1.2.2"
Classic VM (build JDK-1.2.2-W, green threads, sunwjit)
java version "1.2.2"
Solaris VM (build Solaris_JDK_1.2.2_05, native threads, sunwjit)
java version "1.3.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0-I)
Java HotSpot (TM) Client VM (build 1.3-I, interpreted mode)
On Windows 95:
java version "1.2.2"
Classic VM (build JDK-1.2.2-W, native threads, symcjit)
java version "1.3.0rc3"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0rc3-Z)
Java HotSpot(TM) Client VM (build 1.3.0rc3-Z, mixed mode)
java version "1.3.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0-C)
Java HotSpot(TM) Client VM (build 1.3.0-C, mixed mode)
If the offset is beyond the end of a DefaultStyledDocument in a call to
setCharacterAttributes() , the method consumes all available memory, and
eventually throws OutOfMemoryError.
Sample code:
import javax.swing.text.StyledDocument;
import javax.swing.text.DefaultStyledDocument;
import javax.swing.text.SimpleAttributeSet;
/** A simple class to test what happens if I try to set character
* attributes beyond the end of the StyledDocument. Ideally, there would
* be some sort of exception. In fact, what happens is an
* ever-increasing use of memory until it runs out. */
public class bugtest {
public static void main(String args[]) {
StyledDocument sd = new DefaultStyledDocument();
SimpleAttributeSet attrib = new SimpleAttributeSet();
sd.setCharacterAttributes(2, 2, attrib, false);
System.out.println("Success - no bug");
}
}
run with java -verbose:gc bugtest to see the result quicker.
(Review ID: 106683)
======================================================================