Skip to content

Trim whitespace from CredHub application names - #3372

Open
yashdotdev13 wants to merge 3 commits into
spring-cloud:mainfrom
yashdotdev13:fix/1873-credhub-application-name-whitespace
Open

yashdotdev13 wants to merge 3 commits into
spring-cloud:mainfrom
yashdotdev13:fix/1873-credhub-application-name-whitespace

Conversation

@yashdotdev13

@yashdotdev13 yashdotdev13 commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Improve handling of whitespace in comma-delimited application names in CredhubEnvironmentRepository.

Changes

  • Trim leading and trailing whitespace from application names before deduplication.
  • Add a regression test for application names containing leading and trailing whitespace.
  • Make test helper path normalization platform-independent.

Testing

  • CredhubEnvironmentRepositoryTests — 13 tests passed.
  • Full spring-cloud-config-server module tests passed successfully.

Signed-off-by: 98001yash <yashchauhan.gaya@gmail.com>
@ryanjbaxter

Copy link
Copy Markdown
Contributor

I dont see how this fixes #1873. That issue is about comma separated list of application names, not white spaces

@yashdotdev13

yashdotdev13 commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor Author

Thanks for pointing this out. After revisiting the original issue, I realize that my PR only addresses whitespace handling and does not solve the core requirement of supporting multiple comma-separated application names.

I'll revisit the implementation to handle each application name individually and update the PR accordingly. Sorry for the misunderstanding.

@ryanjbaxter

Copy link
Copy Markdown
Contributor

Then the PR description should be updated since it does not fix the issue

@yashdotdev13

yashdotdev13 commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor Author

You're right. I'll keep this PR focused on whitespace normalization in CredHub application names rather than addressing #1873. I'll update the PR title and description accordingly. Thanks for the clarification!

@yashdotdev13 yashdotdev13 changed the title Fix whitespace handling in CredHub application names Trim whitespace from CredHub application names Nov 2, 2026
@yashdotdev13

yashdotdev13 commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor Author

hey @ryanjbaxter , ha've updated the PR title and description and removed the reference to #1873. This PR now focuses solely on whitespace normalization in CredHub application names. Thanks for your feedback and guidance!

Signed-off-by: 98001yash <yashchauhan.gaya@gmail.com>
@yashdotdev13

Copy link
Copy Markdown
Contributor Author

Addressed all three review comments and pushed the changes. Tests are passing. Could you please take another look? Thanks!

Signed-off-by: 98001yash <yashchauhan.gaya@gmail.com>
@yashdotdev13

Copy link
Copy Markdown
Contributor Author

Updated to reuse the normalized values and avoid duplicating the logic. Thanks!

List<String> labels = normalize(label);

Environment environment = new Environment(application, split(profile), label, null, null);
List<String> normalizedApplications = normalize(application);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Use normalize(String commaDelimitedItems, String defaultItem)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Just to clarify, should the Environment metadata include the default application/profile values from the normalized lists, or should it preserve the original metadata behavior while reusing the normalized values for property source lookup?

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants