Skip to content

Commit

Permalink
GBS-55 | fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
MenekseYuncu committed Oct 25, 2024
1 parent 3cc6f04 commit 223d60a
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public boolean isValid(String value, ConstraintValidatorContext context) {

String lowerCasedValue = value.toLowerCase();

if (value.startsWith(" ") || value.endsWith(" ")) {
if (!value.trim().equals(value)) {
context.disableDefaultConstraintViolation();
context.buildConstraintViolationWithTemplate("name must not start or end with whitespace")
.addConstraintViolation();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
package org.gelecekbilimde.scienceplatform.user.exception;

import org.gelecekbilimde.scienceplatform.common.exception.AbstractServerException;
import org.gelecekbilimde.scienceplatform.common.exception.AbstractConflictException;

import java.io.Serial;

public final class UsernameAlreadyTakenException extends AbstractServerException {
public final class UsernameAlreadyTakenException extends AbstractConflictException {

@Serial
private static final long serialVersionUID = -3365493595680402581L;

public UsernameAlreadyTakenException(String username) {
super(("username is already taken" + username));
super(String.format("'%s' username already taken", username));
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public class User extends BaseDomainModel {


public String getUsername() {
return username.toLowerCase();
return username != null ? username.toLowerCase() : null;
}


Expand Down

0 comments on commit 223d60a

Please sign in to comment.