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

IllegalStateException thrown from String.prototype.search function

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P4
    • 8
    • None
    • core-libs
    • None
    • b82
    • generic
    • generic
    • Verified

    Description

      Code "foo.js":

      var str = "hello";
      print(str.search(/foo/g));

      Exception trace:
      Exception in thread "main" java.lang.IllegalStateException: No match available
      at java.util.regex.Matcher.end(Matcher.java:389)
      at jdk.nashorn.internal.objects.NativeRegExp.search(NativeRegExp.java:678)
      at jdk.nashorn.internal.objects.NativeString.search(NativeString.java:739)
      at jdk.nashorn.internal.scripts.Script$foo.runScript(foo.js:2)
      at jdk.nashorn.internal.runtime.ScriptFunction.invoke(ScriptFunction.java:389)
      at jdk.nashorn.internal.runtime.ScriptRuntime.apply(ScriptRuntime.java:310)
      at jdk.nashorn.tools.Shell.apply(Shell.java:322)
      at jdk.nashorn.tools.Shell.runScripts(Shell.java:291)
      at jdk.nashorn.tools.Shell.run(Shell.java:167)
      at jdk.nashorn.tools.Shell.main(Shell.java:136)
      at jdk.nashorn.tools.Shell.main(Shell.java:115)

      Attachments

        Activity

          People

            sundar Sundararajan Athijegannathan
            sundar Sundararajan Athijegannathan
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: