Source:
<code>public Authentication authenticate(Authentication authentication) { Preconditions.checkArgument(authentication instanceof InternalAuthentication, "InternalAuthenticationProvider only supports InternalAuthentication."); String username = authentication.getName(); String password = (String) authentication.getCredentials(); if (Strings.isNullOrEmpty(username)) { throw new BadCredentialsException("InternalAuthenticationProvider: Empty Username"); } if (Strings.isNullOrEmpty(password)) { throw new BadCredentialsException("InternalAuthenticationProvider: Empty Password"); } assertUserNotLocked(username); User user = userProvisioning.getByUsernameWithPassword(username); if (user == null) { throw new BadCredentialsException("The user with the username '" + username + "' doesn't exist!"); } if (user.isActive() != Boolean.TRUE) { throw new DisabledException("The user with the username '" + username + "' is disabled!"); } if (!bCryptPasswordEncoder.matches(password, user.getPassword())) { if (passwordEncoder.isPasswordValid(user.getPassword(), password, user.getId())) { User replaceUser = new User.Builder(user).setPassword(password).build(); userProvisioning.replace(user.getId(), replaceUser); <START> } else { <END> throw new BadCredentialsException("Bad credentials"); } } User authUser = new User.Builder(username).setId(user.getId()).build(); List<GrantedAuthority> grantedAuthorities = new ArrayList<>(); for (Role role : user.getRoles()) { grantedAuthorities.add(new SimpleGrantedAuthority(role.getValue())); } return new InternalAuthentication(authUser, password, grantedAuthorities); }</code><technical_language>I else block needs level out</technical_language>

Target:
public Authentication authenticate(Authentication authentication) { Preconditions.checkArgument(authentication instanceof InternalAuthentication, "InternalAuthenticationProvider only supports InternalAuthentication."); String username = authentication.getName(); String password = (String) authentication.getCredentials(); if (Strings.isNullOrEmpty(username)) { throw new BadCredentialsException("InternalAuthenticationProvider: Empty Username"); } if (Strings.isNullOrEmpty(password)) { throw new BadCredentialsException("InternalAuthenticationProvider: Empty Password"); } assertUserNotLocked(username); User user = userProvisioning.getByUsernameWithPassword(username); if (user == null) { throw new BadCredentialsException("The user with the username '" + username + "' doesn't exist!"); } if (user.isActive() != Boolean.TRUE) { throw new DisabledException("The user with the username '" + username + "' is disabled!"); } if (!bCryptPasswordEncoder.matches(password, user.getPassword())) { if (shaPasswordEncoder.isPasswordValid(user.getPassword(), password, user.getId())) { User replaceUser = new User.Builder(user).setPassword(password).build(); userProvisioning.replace(user.getId(), replaceUser); } else { throw new BadCredentialsException("Bad credentials"); } } User authUser = new User.Builder(username).setId(user.getId()).build(); List<GrantedAuthority> grantedAuthorities = new ArrayList<>(); for (Role role : user.getRoles()) { grantedAuthorities.add(new SimpleGrantedAuthority(role.getValue())); } return new InternalAuthentication(authUser, password, grantedAuthorities); }