}
catch( ConstraintViolationException e )
{
try
{
ConstraintViolationMessages cvm = new ConstraintViolationMessages();
// CVE are considered client faults
String messages = "";
Locale locale = ObjectSelection.type( Locale.class );
for( ConstraintViolation constraintViolation : e.constraintViolations() )
{
if( !messages.isEmpty() )
{
messages += "\n";
}
messages += cvm.getMessage( constraintViolation, locale );
}
response.setEntity( new StringRepresentation( messages ) );
response.setStatus( Status.CLIENT_ERROR_UNPROCESSABLE_ENTITY );
}