Skip to content

Commit

Permalink
check if test.name isBlank before saving
Browse files Browse the repository at this point in the history
  • Loading branch information
stalep committed Oct 2, 2023
1 parent 51eb6dc commit 6b4a417
Showing 1 changed file with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,8 @@ public Test add(Test dto){
if (!identity.hasRole(dto.owner)) {
throw ServiceException.forbidden("This user does not have the " + dto.owner + " role!");
}
if(dto.name == null || dto.name.isBlank())
throw ServiceException.badRequest("Test name can not be empty");
TestDAO test = TestMapper.to(dto);
addAuthenticated(test);
Hibernate.initialize(test.tokens);
Expand Down

0 comments on commit 6b4a417

Please sign in to comment.