Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4150122

TextComponent(text) and TextComponent.setText(t) work inconsistently

    Details

    • Subcomponent:
    • Resolved In Build:
      1.2fcs
    • CPU:
      sparc
    • OS:
      solaris_2.5
    • Verification:
      Verified

      Description



      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

      ======================================================================

        Attachments

          Activity

            People

            • Assignee:
              dmendenhsunw David Mendenhall (Inactive)
              Reporter:
              dsilaev Dmitri Silaev
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Imported:
                Indexed: