We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 3e688b0 commit 7ada3a9Copy full SHA for 7ada3a9
1 file changed
api/src/main/java/org/apache/cloudstack/acl/Rule.java
@@ -25,16 +25,18 @@
25
26
public final class Rule {
27
private final String rule;
28
+ private final Pattern compiledPattern;
29
private final static Pattern ALLOWED_PATTERN = Pattern.compile("^[a-zA-Z0-9*]+$");
30
31
public Rule(final String rule) {
32
validate(rule);
33
this.rule = rule;
34
+ this.compiledPattern = Pattern.compile(rule.toLowerCase().replace("*", "\\w*"));
35
}
36
37
public boolean matches(final String commandName) {
38
return StringUtils.isNotEmpty(commandName)
- && commandName.toLowerCase().matches(rule.toLowerCase().replace("*", "\\w*"));
39
+ && compiledPattern.matcher(commandName.toLowerCase()).matches();
40
41
42
public String getRuleString() {
0 commit comments