Skip to content

Commit 410812c

Browse files
committed
Reduce Diff Size
This commit reorders the originally changed boolean logic so that it returns false early, as it did before. This allows the change to remain small and also keeps the most complex logical statements outside of the if statement. Signed-off-by: Josh Cummings <3627351+jzheaux@users.noreply.github.com>
1 parent 329d9e2 commit 410812c

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

crypto/src/main/java/org/springframework/security/crypto/password/AbstractValidatingPasswordEncoder.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,10 @@ public abstract class AbstractValidatingPasswordEncoder implements PasswordEncod
4444

4545
@Override
4646
public final boolean matches(@Nullable CharSequence rawPassword, @Nullable String encodedPassword) {
47-
if (StringUtils.hasLength(rawPassword) && StringUtils.hasLength(encodedPassword)) {
48-
return matchesNonNull(rawPassword.toString(), encodedPassword);
47+
if (!StringUtils.hasLength(rawPassword) || !StringUtils.hasLength(encodedPassword)) {
48+
return false;
4949
}
50-
return false;
50+
return matchesNonNull(rawPassword.toString(), encodedPassword);
5151
}
5252

5353
protected abstract boolean matchesNonNull(String rawPassword, String encodedPassword);

0 commit comments

Comments
 (0)