US06: Add a button for the owner create form to the owners list, fix bug where all whitespaces were considered valid input
This commit is contained in:
@@ -127,7 +127,7 @@ public class OwnerJdbcDao implements OwnerDao {
|
||||
int changes = jdbcTemplate.update(connection -> {
|
||||
PreparedStatement ps = connection.prepareStatement(sql, PreparedStatement.RETURN_GENERATED_KEYS);
|
||||
|
||||
ps.setString(1, owner.getName());
|
||||
ps.setString(1, owner.getName().trim());
|
||||
ps.setObject(2, owner.getCreatedAt());
|
||||
ps.setObject(3, owner.getUpdatedAt());
|
||||
return ps;
|
||||
|
@@ -12,7 +12,7 @@ import java.util.Map;
|
||||
@Component
|
||||
public class Validator {
|
||||
public void validateNewOwner(Owner owner) throws ValidationException {
|
||||
if(owner.getName() == null || owner.getName().isEmpty()) {
|
||||
if(owner.getName() == null || owner.getName().isEmpty() || owner.getName().isBlank()) {
|
||||
throw new ValidationException("Required value name missing");
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user