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

StringIndexOutOfBoundsException from /.*((a[^a]+){2})c$/.exec('ababc')

    Details

    • Subcomponent:
    • Resolved In Build:
      b21
    • CPU:
      generic
    • OS:
      generic

      Description

      FULL PRODUCT VERSION :
      java version "1.8.0_121"
      Java(TM) SE Runtime Environment (build 1.8.0_121-b13)
      Java HotSpot(TM) 64-Bit Server VM (build 25.71-b01-internal-jvmci-0.24, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Linux stola-ThinkPad 3.16.0-38-generic #52~14.04.1-Ubuntu SMP Fri May 8 09:43:57 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

      A DESCRIPTION OF THE PROBLEM :
      Evaluation of /.*((a[^a]+){2})c$/.exec('ababc') results in StringIndexOutOfBoundsException

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1. Start jjs
      2. Enter /.*((a[^a]+){2})c$/.exec('ababc')
      => java.lang.StringIndexOutOfBoundsException: String index out of range: -1 is printed into the console

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Correct result, i.e., ababc, abab, ab printed into the console.
      ACTUAL -
      java.lang.StringIndexOutOfBoundsException: String index out of range: -1 is printed into the console

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      java.lang.StringIndexOutOfBoundsException: String index out of range: -1

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      /.*((a[^a]+){2})c$/.exec('ababc')
      ---------- END SOURCE ----------

        Attachments

          Activity

            People

            • Assignee:
              pmuthuswamy Priya Lakshmi Muthuswamy (Inactive)
              Reporter:
              webbuggrp Webbug Group
            • Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: