Harmony
  1. Harmony
  2. HARMONY-489

new Double("1E+-20") should throw exception but doesn't

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Classlib
    • Labels:
      None

      Description

      The statement "new Double("1E+20");" should throw a NumberFormatException, but the parser contains a special case which causes it to skip the '+' and then accept the valid string '-20'. Unfortunately removing the special case wouldn't help because '1E+20' is valid but '+20' fails parseInt. Therefore I think another check is required to prevent the '' being accepted.

      I also note that the RI throws NumberFormatException containing the original string where as Harmony would propogate the exception thrown by parseInt which would contain the exponent substring only. I'll also correct this in my patch.

        Activity

        Mark Hindess created issue -
        Hide
        Mark Hindess added a comment -

        Patch with test and fix.

        Show
        Mark Hindess added a comment - Patch with test and fix.
        Mark Hindess made changes -
        Field Original Value New Value
        Attachment double.parse.problem.diff [ 12334418 ]
        Mark Hindess made changes -
        Assignee Mark Hindess [ hindessm ]
        Hide
        Mark Hindess added a comment -

        Applied in r414834.

        Show
        Mark Hindess added a comment - Applied in r414834.
        Mark Hindess made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Mark Hindess made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        Transition Time In Source Status Execution Times Last Executer Last Execution Date
        Open Open Resolved Resolved
        24d 19h 30m 1 Mark Hindess 16/Jun/06 21:27
        Resolved Resolved Closed Closed
        746d 18h 51m 1 Mark Hindess 02/Jul/08 16:18

          People

          • Assignee:
            Mark Hindess
            Reporter:
            Mark Hindess
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development