fix bugs in RulesDrivenPolicyAdvisor

This commit is contained in:
Grahame Grieve 2025-01-10 17:00:21 +11:00
parent 73b53b9d7a
commit 2fa3b49915
1 changed files with 2 additions and 2 deletions

View File

@ -53,7 +53,7 @@ public class RulesDrivenPolicyAdvisor extends BasePolicyAdvisorForFullValidation
public boolean matches(@Nonnull String mid, @Nonnull String path, String[] p) {
if (regex) {
return stringMatches(id, mid) && regexMatches(path, path);
return stringMatches(id, mid) && regexMatches(this.path, path);
} else {
return stringMatches(id, mid) && pathMatches(pathSegments, p);
}
@ -97,7 +97,7 @@ public class RulesDrivenPolicyAdvisor extends BasePolicyAdvisorForFullValidation
if (specifier == null) {
return true;
} else if (specifier.endsWith("*")) {
return specifier.substring(0, specifier.length()-1).equalsIgnoreCase(actual.substring(0, specifier.length()-1));
return specifier.substring(0, specifier.length()-1).equalsIgnoreCase(actual.substring(0, Integer.min(specifier.length()-1, actual.length())));
} else {
return specifier.equalsIgnoreCase(actual);
}