Skip to content

Commit

Permalink
Catch case where too many capture groups defined
Browse files Browse the repository at this point in the history
  • Loading branch information
cjcjameson committed May 18, 2015
1 parent 9713b00 commit 09575f6
Showing 1 changed file with 3 additions and 1 deletion.
Expand Up @@ -517,8 +517,10 @@ public FormValidation doCheckRegexp(@QueryParameter String value) {
Pattern pattern = Pattern.compile(value);
if (pattern.matcher("").groupCount() == 1) {
return FormValidation.ok();
} else {
} else if (pattern.matcher("").groupCount() == 0) {
return FormValidation.error("No capture group defined");
} else {
return FormValidation.error("Too many capture groups defined");
}
} catch (PatternSyntaxException e) {
return FormValidation.error(e, "Syntax error in regular-expression pattern");
Expand Down

0 comments on commit 09575f6

Please sign in to comment.