Update UserAccountService.java
Moving the call to addUserAccount method out of condition to check if violations exist.
This commit is contained in:
parent
66360a6b31
commit
d5399a7677
|
@ -29,15 +29,10 @@ public class UserAccountService {
|
|||
StringBuilder sb = new StringBuilder();
|
||||
for (ConstraintViolation<UserAccount> constraintViolation : violations) {
|
||||
sb.append(constraintViolation.getMessage());
|
||||
}
|
||||
|
||||
dao.addUserAccount(useraccount);
|
||||
|
||||
}
|
||||
throw new ConstraintViolationException("Error occurred: " + sb.toString(), violations);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
dao.addUserAccount(useraccount);
|
||||
return "Account for " + useraccount.getName() + " Added!";
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue