[#25] Fix validation error

Signed-off-by: Ori Bruk <o.bruk@yadro.com>
This commit is contained in:
Ori Bruk 2024-11-13 12:02:41 +03:00
parent 694bb963e4
commit 80c7ba58b2

View file

@ -16,10 +16,11 @@ import static java.util.Objects.isNull;
public class Validator { public class Validator {
public static <T> void validate(T object) { public static <T> void validate(T object) {
StringBuilder errorMessage = new StringBuilder().append(System.lineSeparator()); StringBuilder errorMessage = new StringBuilder();
process(object, errorMessage); process(object, errorMessage);
if (errorMessage.length() != 0) { if (errorMessage.length() != 0) {
errorMessage.insert(0, System.lineSeparator());
throw new ValidationFrostFSException(errorMessage.toString()); throw new ValidationFrostFSException(errorMessage.toString());
} }
} }