Skip to content

Conversation

@cwperks
Copy link
Owner

@cwperks cwperks commented Oct 8, 2025

Description

This PR changes the behavior of WildcardMatcher slightly to create a WildcardMatcher.NONE if a caller tries to create a WildcardMatcher from an empty string.

  • Category (Enhancement, New feature, Bug fix, Test fix, Refactoring, Maintenance, Documentation)

Bug fix

Check List

  • New functionality includes testing
  • New functionality has been documented
  • New Roles/Permissions have a corresponding security dashboards plugin PR
  • API changes companion pull request created
  • Commits are signed per the DCO using --signoff

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

… empty string

Signed-off-by: Craig Perkins <cwperx@amazon.com>
@cwperks cwperks requested a review from willyborankin as a code owner October 8, 2025 18:21

public static WildcardMatcher from(String pattern) {
if (pattern == null) {
if (pattern == null || pattern.isBlank()) {
Copy link

Choose a reason for hiding this comment

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

Should you perform a trim() on the pattern as well ?

Copy link
Owner Author

Choose a reason for hiding this comment

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

trim() isn't necessary since isBlank() will return true if the string is only whitespace: https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html#isBlank()

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.

2 participants