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

BigDecimal throws an ArrayIndexOutOfBoundsException if string ends in 'E'

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Icon: P3 P3
    • None
    • 7
    • 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.

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

              Created:
              Updated:
              Resolved: