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 authored and jesperpedersen committed Oct 3, 2023
1 parent 867c328 commit ebdb45f
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 ebdb45f

Please sign in to comment.