BigDecimal throws an ArrayIndexOutOfBoundsException if string ends in 'E'

XMLWordPrintable

    • Type: Bug
    • Resolution: Cannot Reproduce
    • Priority: P3
    • None
    • Affects Version/s: 7
    • Component/s: core-libs
    • None

      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.

            Assignee:
            Brian Burkhalter
            Reporter:
            Webbug Group
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: