Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unused code branch In GitCredentialsProviderFactory #2679

Conversation

ryanjbaxter
Copy link
Contributor

Fixes #2674

@ryanjbaxter ryanjbaxter added this to the 4.1.5 milestone Dec 13, 2024
@@ -92,13 +92,6 @@ else if (hasText(username)) {
this.logger.debug("Constructing UsernamePasswordCredentialsProvider for URI " + uri);
provider = new UsernamePasswordCredentialsProvider(username, password.toCharArray());
}
else if (hasText(username) && !hasText(passphrase)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe it shouldn't be removed and add && hasText(password) to the branch above? That will fix a potential NPE there anyway.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@spencergibb This logic is tasting if passphrase has text not password. I agree that we should add a null check for password above. But we probably don't want to use a hasText check since having an empty string for password is valid (we have a test for that).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

right, null check works

@ryanjbaxter ryanjbaxter force-pushed the gitcredentialsprovider-logic-has-username-no-password branch from eb6da89 to b502276 Compare December 13, 2024 21:26
@ryanjbaxter ryanjbaxter merged commit 16f93aa into spring-cloud:4.1.x Dec 14, 2024
1 check passed
@ryanjbaxter ryanjbaxter linked an issue Dec 14, 2024 that may be closed by this pull request
@ryanjbaxter ryanjbaxter removed this from the 4.1.5 milestone Dec 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Possible unused branch in GitCredentialsProviderFactory
2 participants