- 
    Bug 
- 
    Resolution: Fixed
- 
     P4 P4
- 
    None
- 
    None
- 
        b82
- 
        generic
- 
        generic
- 
        Verified
                    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)
            
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)