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

TTY: NullPointerException at com.sun.tools.jdi.MirrorImpl.validateMirrors

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 1.4.1
    • 1.4.0
    • core-svc
    • None
    • hopper
    • generic
    • generic



      Name: tb29552 Date: 06/08/2001


      Need a more graceful message when user tries to evaluate
      a method such as length() or toString() as a field:


      % cat HelloWorld.java
      class HelloWorld {
          static String s = "Hello World";
          public static void main(String[] args){
              System.out.println(s);
          }
      }

      % javac -g HelloWorld.java
      % jdb HelloWorld
      Initializing jdb ...
      > stop in HelloWorld.main
      Deferring breakpoint HelloWorld.main.
      It will be set after the class is loaded.
      > run
      run HelloWorld
      >
      VM Started: Set deferred breakpoint HelloWorld.main

      Breakpoint hit: "thread=main", HelloWorld.main(), line=4 bci=0
      4 System.out.println(s);

      main[1] print HelloWorld.s
       HelloWorld.s = "Hello World"

      main[1] print HelloWorld.s.NotAField
      com.sun.tools.example.debug.expr.ParseException: No instance field or method
      with the name NotAField in java.lang.String
       HelloWorld.s.NotAField = null

      main[1] print HelloWorld.s.length
      java.lang.NullPointerException
              at com.sun.tools.jdi.MirrorImpl.validateMirrors(MirrorImpl.java:75)
              at
      com.sun.tools.jdi.ObjectReferenceImpl.getValues(ObjectReferenceImpl.java:149)
              at
      com.sun.tools.jdi.ObjectReferenceImpl.getValue(ObjectReferenceImpl.java:144)
              at
      com.sun.tools.example.debug.expr.LValue$LValueInstanceMember.getValue(LValue.java:281)
              at
      com.sun.tools.example.debug.expr.ExpressionParser.evaluate(ExpressionParser.java:54)
              at com.sun.tools.example.debug.tty.Commands.evaluate(Commands.java:114)
              at com.sun.tools.example.debug.tty.Commands.doPrint(Commands.java:1498)
              at com.sun.tools.example.debug.tty.Commands$4.action(Commands.java:1520)
              at com.sun.tools.example.debug.tty.Commands$1.run(Commands.java:67)
       HelloWorld.s.length = null


      main[1] print HelloWorld.s.length()
       HelloWorld.s.length() = 11

      main[1] print HelloWorld.s.toString
      java.lang.NullPointerException
              at com.sun.tools.jdi.MirrorImpl.validateMirrors(MirrorImpl.java:75)
              at
      com.sun.tools.jdi.ObjectReferenceImpl.getValues(ObjectReferenceImpl.java:149)
              at
      com.sun.tools.jdi.ObjectReferenceImpl.getValue(ObjectReferenceImpl.java:144)
              at
      com.sun.tools.example.debug.expr.LValue$LValueInstanceMember.getValue(LValue.java:281)
              at
      com.sun.tools.example.debug.expr.ExpressionParser.evaluate(ExpressionParser.java:54)
              at com.sun.tools.example.debug.tty.Commands.evaluate(Commands.java:114)
              at com.sun.tools.example.debug.tty.Commands.doPrint(Commands.java:1498)
              at com.sun.tools.example.debug.tty.Commands$4.action(Commands.java:1520)
              at com.sun.tools.example.debug.tty.Commands$1.run(Commands.java:67)

      main[1] print HelloWorld.s.toString()
       HelloWorld.s.toString() = "Hello World"

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

            tbell Tim Bell
            tbell Tim Bell
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: