Commit a54a24f7 authored by Maxym Borodenko's avatar Maxym Borodenko Committed by Matija Obreza

Updated DetailedConstraintViolationException

parent 687ec6e3
......@@ -20,8 +20,6 @@ import java.util.Set;
import javax.validation.ConstraintViolation;
import javax.validation.ConstraintViolationException;
import org.hibernate.validator.internal.engine.path.PathImpl;
/**
* @author Maxym Borodenko
*/
......@@ -72,8 +70,9 @@ public class DetailedConstraintViolationException extends ConstraintViolationExc
final StringBuilder message = new StringBuilder("Validation failed: ");
if (super.getConstraintViolations() != null) {
for (final ConstraintViolation<?> cv : super.getConstraintViolations()) {
final PathImpl path = (PathImpl) cv.getPropertyPath();
message.append(path.getLeafNode().getName());
String[] pathParts = cv.getPropertyPath().toString().split("\\.");
String prop = pathParts[pathParts.length - 1];
message.append(prop);
message.append(" -> ");
message.append(cv.getMessage());
message.append("; ");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment