-
Bug
-
Resolution: Fixed
-
P3
-
1.2.0
-
1.2fcs
-
sparc
-
solaris_2.5
-
Verified
Name: dsC58869 Date: 06/18/98
The bug has been introduced into JDK-1.2beta4-J release.
The constructor TextComponent(String text) and method
TextComponent.setText(String t) work inconsistently with null parameter.
The constructor sets text field to null, but the method to empty string.
==== Here is the test demonstrating the bug ====
import java.awt.*;
public class Test{
public static void main(String[] args){
String text = null;
TextComponent tc = new TextArea(text);
System.out.println("Text:" + tc.getText());
tc.setText(text);
System.out.println("Text:" + tc.getText());
}
}
==== Here is the output of the test ====
%java Test
Text:null
Text:
^C
======================================================================
Justification:
The constructor and method sould work consistently
======================================================================