Index: src/main/java/java/util/regex/MatchResultImpl.java =================================================================== --- src/main/java/java/util/regex/MatchResultImpl.java (revision 417830) +++ src/main/java/java/util/regex/MatchResultImpl.java (working copy) @@ -79,9 +79,11 @@ MatchResultImpl res = new MatchResultImpl(this.string, this.leftBound, this.rightBound, this.groupCount - 1, 0, 0); - System.arraycopy(groupBounds, 0, res.groupBounds, 0, - this.groupBounds.length); - + res.valid = valid; + if (valid) { + System.arraycopy(groupBounds, 0, res.groupBounds, 0, + this.groupBounds.length); + } return res; }