Skip to content

Commit 0fd8080

Browse files
committed
Defensively code groups
1 parent 8555b73 commit 0fd8080

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/main/java/org/primeframework/mvc/content/json/BaseJacksonContentHandler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ private void addFieldError(InvalidFormatException e) {
211211
String messageText = e.getMessage();
212212
Matcher matchesEnumNotValidValue = invalidEnumerationValue.matcher(messageText);
213213
String message = null;
214-
if (matchesEnumNotValidValue.matches()) {
214+
if (matchesEnumNotValidValue.matches() && matchesEnumNotValidValue.groupCount() == 2) {
215215
code = "[invalid]%s".formatted(field);
216216
// if we have an invalid enum value, provide a better message
217217
String possibleValues = matchesEnumNotValidValue.group(2);

0 commit comments

Comments
 (0)