I ran into a strange java.lang.ArrayIndexOutOfBoundsException: 64
error while parsing text using Nashorn Javascript engine. To reproduce the problem in JJS:
var col0 = " xxxx, xxx xxxxxx xxxxxxxxx xxxxxxx, xxxx xxxxx xxxxx ";
var name = /([^\s]+),(.*)+/.exec(col0);
Some other variants of the test string also cause the same exception, for example.
var col0 = "x, xxxxxxxxxx xxxxxxxxx xxxxxxx, xxxx xxxxx xxxxx ";
Happens with JDK8 versions 25, 31 and 40ea (on Windows 8).
This is a bug in our regexp implementation. I've filed a bug for it:
https://bugs.openjdk.java.net/browse/JDK-8073818
Update: You can use the -Dnashorn.regexp.impl=jdk
option as a workaround. This makes Nashorn use the java.util.regex package instead of Joni which doesn't show this bug.