SpringValidatorAdapter properly handles HV-5-style list constraint violations
Issue: SPR-15082
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
* Copyright 2002-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -255,7 +255,7 @@ public class SpringValidatorAdapter implements SmartValidator, javax.validation.
|
||||
protected Object getRejectedValue(String field, ConstraintViolation<Object> violation, BindingResult bindingResult) {
|
||||
Object invalidValue = violation.getInvalidValue();
|
||||
if (!"".equals(field) && (invalidValue == violation.getLeafBean() ||
|
||||
(field.contains(".") && !field.contains("[]")))) {
|
||||
(!field.contains("[]") && (field.contains("[") || field.contains("."))))) {
|
||||
// Possibly a bean constraint with property path: retrieve the actual property value.
|
||||
// However, explicitly avoid this for "address[]" style paths that we can't handle.
|
||||
invalidValue = bindingResult.getRawFieldValue(field);
|
||||
|
||||
Reference in New Issue
Block a user