US07: Fix bug where all whitespaces were considered valid input on owner update

This commit is contained in:
2020-04-05 18:37:08 +02:00
parent 8e3736848d
commit 3b1bae0902
4 changed files with 25 additions and 25 deletions

View File

@@ -165,7 +165,7 @@ public class OwnerJdbcDao implements OwnerDao {
int changes = jdbcTemplate.update(connection -> {
PreparedStatement ps = connection.prepareStatement(sql);
ps.setString(1, owner.getName());
ps.setString(1, owner.getName().trim());
ps.setObject(2, owner.getUpdatedAt());
ps.setObject(3, owner.getId());
return ps;

View File

@@ -21,7 +21,7 @@ public class Validator {
if(owner.getId() == null || owner.getId() == 0) {
throw new ValidationException("Owner Id cannot be null or 0");
}
if(owner.getName() == null || owner.getName().isEmpty()) {
if(owner.getName() == null || owner.getName().isEmpty() || owner.getName().isBlank()) {
throw new ValidationException("Required value for owner missing: name");
}
}