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

BigDecimal throws an ArrayIndexOutOfBoundsException if string ends in 'E'

    XMLWordPrintable

Details

    • Bug
    • Resolution: Cannot Reproduce
    • P3
    • None
    • 7
    • core-libs
    • None

    Description

      FULL PRODUCT VERSION :


      A DESCRIPTION OF THE PROBLEM :
      It assumes that there will always be an exponent following an E. If there isn't, this throws an AIOOBE:

                      // exponent expected
                      if ((c != 'e') && (c != 'E'))
                          throw new NumberFormatException();
                      offset++;
                      c = in[offset]; <---- exception

      Parsing this invalid string should presumably throw a NumberFormatException, instead.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      new BigDecimal( " 1.234E " );


      REPRODUCIBILITY :
      This bug can be reproduced always.

      Attachments

        Issue Links

          Activity

            People

              bpb Brian Burkhalter
              webbuggrp Webbug Group
              Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: