Message interpolation fails with single opening or closing brace in regex character class

Description

A single opening or closing brace inside a character class in a regexp of a @Pattern leads to a MessageDescriptorFormatException, which is caught and swallowed with a warning in ResourceBundleMessageInterpolator. Since the interpolation is aborted there, instead of a message the message template is returned, e.g. "{javax.validation.constraints.Pattern.message}".

For an opening brace, the warning is:

For a closing brace:

This was still working in 5.0.0.Final, as bundled with GlassFish 4.1. I ran into the bug with Payara 4.1.1.171.0.1, that's why I put 5.1.2.Final as affected version, but I also verified it still happens with 5.4.0.Final. I suspect it may have to do with HV-798.

A test case:

Environment

None

Assignee

Guillaume Smet

Reporter

Joachim Kanbach

Labels

None

Feedback Requested

None

Feedback Requested By

None

backPortable

None

Suitable for new contributors

None

backportDecision

None

backportReEvaluate

None

Components

Fix versions

Affects versions

Priority

Minor
Configure