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

TTY: NumberFormatException while trying to set values by 'set' command

    XMLWordPrintable

    Details

    • Subcomponent:
    • Resolved In Build:
      b01
    • CPU:
      generic, sparc
    • OS:
      generic, solaris_7

      Backports

        Description



        Name: dkR10014 Date: 03/29/2002


        The following testbase_nsk test:
           nsk/jdb/set/set001
        fails on all platforms (Solsparc, Solx86, Win, Linux) in all debugged VM mode.

        The test works as follows:
        the jdb stops the debuggee inside the debuggee's runIt() method and then tries
        to set new values for the fields and local variables using 'set <lvalue> = <expr>'
        command. Then the debuggee checks if modified fields/variables have expected
        values. If not, then special errorMessage variable is appended with
        the info of wrong values. The test passes when length of errorMessage
        is equal to 0, and fails otherwise. There are two programs in the test:
          set001.java - launches jdb and debuggee, writes commands to jdb, reads the jdb output,
          set001a.java - the debugged application.

        The NumberFormatException is reported in two test cases:
         - assigning value equals to decimal represenation of Integer.MIN_VALUE,
         - assigning value equals to decimal represenation of Long.MAX_VALUE.

        (Please see another cases with NumberFormatException at the end of bug description.)

        Error output:
        # ERROR: jdb failed to set value for expression(s):
        # ERROR: nsk.jdb.set.set001a.errorMessage = "
        # ERROR: Wrong value of set001a.myStaticField: 0, expected: -2147483648
        # ERROR: Wrong value of _set001a.myInstanceField: 0, expected: 9223372036854775807"
        # ERROR: main[1]
        # ERROR: TEST FAILED

        Below is jdb stdout log redirected to jdb.stdout file:
        ------------------------------------------------------------------
        Initializing jdb ...
        >
        <<COMMAND>>stop in nsk.jdb.set.set001a.main

        Deferring breakpoint nsk.jdb.set.set001a.main.
        It will be set after the class is loaded.
        >
        <<COMMAND>>run

        run nsk.jdb.set.set001a
        >
        VM Started: Set deferred breakpoint nsk.jdb.set.set001a.main

        Breakpoint hit: "thread=main", nsk.jdb.set.set001a.main(), line=22 bci=0

        main[1]
        <<COMMAND>>stop in nsk.jdb.set.set001a.lastBreak

        Set breakpoint nsk.jdb.set.set001a.lastBreak
        main[1]
        <<COMMAND>>cont

        >
        Breakpoint hit: "thread=main", nsk.jdb.set.set001a.lastBreak(), line=25 bci=0

        main[1]
        <<COMMAND>>step

        >
        Step completed: "thread=main", nsk.jdb.set.set001a.runIt(), line=36 bci=30

        main[1]
        <<COMMAND>>set nsk.jdb.set.set001a.myStaticField = -2147483648

        java.lang.NumberFormatException: For input string: "2147483648"
         nsk.jdb.set.set001a.myStaticField = -2147483648 = null
        main[1]
        <<COMMAND>>set nsk.jdb.set.set001a._set001a.myInstanceField = 9223372036854775807

        java.lang.NumberFormatException: For input string: "9223372036854775807"
         nsk.jdb.set.set001a._set001a.myInstanceField = 9223372036854775807 = null
        main[1]
        <<COMMAND>>set nsk.jdb.set.set001a._set001a.myArrayField[0][0].line = "ABCDE"

         nsk.jdb.set.set001a._set001a.myArrayField[0][0].line = "ABCDE" = "ABCDE"
        main[1]
        <<COMMAND>>set localInt = java.lang.Integer.MIN_VALUE

         localInt = java.lang.Integer.MIN_VALUE = -2147483648
        main[1]
        <<COMMAND>>cont

        >
        Breakpoint hit: "thread=main", nsk.jdb.set.set001a.lastBreak(), line=25 bci=0

        main[1]
        <<COMMAND>>eval nsk.jdb.set.set001a.errorMessage

         nsk.jdb.set.set001a.errorMessage = "
        Wrong value of set001a.myStaticField: 0, expected: -2147483648
        Wrong value of _set001a.myInstanceField: 0, expected: 9223372036854775807"
        main[1]
        <<COMMAND>>cont

        >
        The application exited
        ------------------------------------------------------------------
           
        How to reproduce:
         1. cd /net/sqesvr.sfbay/export/vsn/GammaBase/Bugs/{this_bug_number}
         2. sh doit.sh <JAVA_HOME>

        The test will appear in the next testbase_nsk r13 relase.

        When I tried to set other various values manually in jdb session,
        there were following results.

        For integer field:

        main[1] set nsk.jdb.set.set001a.myStaticField = -1
        operation not yet supported
         nsk.jdb.set.set001a.myStaticField = -1 = null

        main[1] set nsk.jdb.set.set001a.myStaticField = java.lang.Integer.MAX_VALUE
         nsk.jdb.set.set001a.myStaticField = java.lang.Integer.MAX_VALUE = 2147483647

        main[1] set nsk.jdb.set.set001a.myStaticField = 2147483647
         nsk.jdb.set.set001a.myStaticField = 2147483647 = 2147483647

        main[1] set nsk.jdb.set.set001a.myStaticField = 0x80000000
        java.lang.NumberFormatException: For input string: "0x80000000"
         nsk.jdb.set.set001a.myStaticField = 0x80000000 = null

        main[1] set nsk.jdb.set.set001a.myStaticField = 0x7fffffff
        java.lang.NumberFormatException: For input string: "0x7fffffff"
         nsk.jdb.set.set001a.myStaticField = 0x7fffffff = null

        main[1] set nsk.jdb.set.set001a.myStaticField = 0x1
        java.lang.NumberFormatException: For input string: "0x1"
         nsk.jdb.set.set001a.myStaticField = 0x1 = null

        For long field:

        main[1] set nsk.jdb.set.set001a._set001a.myInstanceField = -1
        operation not yet supported
         nsk.jdb.set.set001a._set001a.myInstanceField = -1 = null

        main[1] set nsk.jdb.set.set001a._set001a.myInstanceField = java.lang.Integer.MAX_VALUE
         nsk.jdb.set.set001a._set001a.myInstanceField = java.lang.Integer.MAX_VALUE = 2147483647

        main[1] set nsk.jdb.set.set001a._set001a.myInstanceField = java.lang.Integer.MAX_VALUE+1
         nsk.jdb.set.set001a._set001a.myInstanceField = java.lang.Integer.MAX_VALUE+1 = -2147483648

        main[1] set nsk.jdb.set.set001a._set001a.myInstanceField = java.lang.Long.MAX_VALUE
        com.sun.tools.example.debug.expr.ParseException: Name unknown: java.lang.Long.MAX_VALUE
         nsk.jdb.set.set001a._set001a.myInstanceField = java.lang.Long.MAX_VALUE = null

        main[1] set nsk.jdb.set.set001a._set001a.myInstanceField = java.lang.Long.MIN_VALUE
        com.sun.tools.example.debug.expr.ParseException: Name unknown: java.lang.Long.MIN_VALUE
         nsk.jdb.set.set001a._set001a.myInstanceField = java.lang.Long.MIN_VALUE = null

        main[1] set nsk.jdb.set.set001a._set001a.myInstanceField = 9223372036854775807L
        java.lang.NumberFormatException: For input string: "9223372036854775807L"
         nsk.jdb.set.set001a._set001a.myInstanceField = 9223372036854775807L = null

        main[1] set nsk.jdb.set.set001a._set001a.myInstanceField = 1L
        java.lang.NumberFormatException: For input string: "1L"
         nsk.jdb.set.set001a._set001a.myInstanceField = 1L = null

        main[1] set nsk.jdb.set.set001a._set001a.myInstanceField = 0x8000000000000000L
        java.lang.NumberFormatException: For input string: "0x8000000000000000L"
         nsk.jdb.set.set001a._set001a.myInstanceField = 0x8000000000000000L = null

        main[1] set nsk.jdb.set.set001a._set001a.myInstanceField = 0x7fffffffffffffffL
        java.lang.NumberFormatException: For input string: "0x7fffffffffffffffL"
         nsk.jdb.set.set001a._set001a.myInstanceField = 0x7fffffffffffffffL = null


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

          Attachments

            Issue Links

              Activity

                People

                Assignee:
                sla Staffan Larsen (Inactive)
                Reporter:
                kdossunw Kdos Kdos (Inactive)
                Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: