spring-cloud/spring-cloud-config

Possible unused branch in GitCredentialsProviderFactory

Closed this issue · 0 comments

Describe the bug
It seems the branch starting on line 99 is never executed because whenever hasText(username) is true, the branch starting on line 93 is executed.

else if (hasText(username)) {
this.logger.debug(
"Constructing UsernamePasswordCredentialsProvider for URI " + uri);
provider = new UsernamePasswordCredentialsProvider(username,
password.toCharArray());
}
else if (hasText(username) && !hasText(passphrase)) {
// useful for token based login gh-1602
// see
// https://stackoverflow.com/questions/28073266/how-to-use-jgit-to-push-changes-to-remote-with-oauth-access-token
this.logger.debug(
"Constructing UsernamePasswordCredentialsProvider for URI " + uri);
provider = new UsernamePasswordCredentialsProvider(username, (String) null);
}