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

printing a field whose value is null gives a misleading error message

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 1.1.4
    • 1.1.3
    • core-svc
    • 1.1.4
    • generic
    • windows_95
    • Not verified

      When you print a field whose value is null, the error message says it is not a valid field. It *should* just report the value as null.


      To use this test case, type the following:

      javac -g WrongMessage.java
      jdb WrongMessage
      stop in WrongMessage.stop
      run
      print w.a
      print w.b

      ---

      For 'print w.a', you get:

        w.a = this is a non-null string

      For 'print w.b', you get:

        "b" is not a valid field of (WrongMessage)0xee306998

      This is wrong! You SHOULD get:

        w.b = null


      --- Here is the test case code:

      public class WrongMessage
      {
        String a;
        String b;

        public static void main(String argv[])
        {
          WrongMessage w = new WrongMessage();
          w.a = "this is a non-null string";
          stop(w);
        }

        public static void stop(WrongMessage w)
        {
          System.out.println("w.a = "+w.a);
          System.out.println("w.b = "+w.b);
        }
      }

            rfield Robert Field (Inactive)
            rschiavisunw Richard Schiavi (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: