Skip to content

Commit

Permalink
Update PasswordValidator.java
Browse files Browse the repository at this point in the history
  • Loading branch information
OksanaEnko authored Oct 9, 2024
1 parent 2e3209f commit 903f5f1
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/main/java/core/basesyntax/PasswordValidator.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ public class PasswordValidator {
private static final int MIN_PASSWORD_LENGTH = 8;

public void validate(String password, String repeatPassword) throws PasswordValidationException {
if (password == null || repeatPassword == null) {
throw new PasswordValidationException("Passwords cannot be null");
}
if (password.length() < MIN_PASSWORD_LENGTH || !password.equals(repeatPassword)) {
if (password == null || repeatPassword == null ||
password.length() < MIN_PASSWORD_LENGTH ||
!password.equals(repeatPassword)) {
throw new PasswordValidationException("Wrong passwords");
}
}
}

0 comments on commit 903f5f1

Please sign in to comment.