MCPcopy Create free account
hub / github.com/apache/tomcat / match

Method match

java/org/apache/tomcat/util/digester/RulesBase.java:135–159  ·  view source on GitHub ↗

Return a List of all registered Rule instances that match the specified nesting pattern, or a zero-length List if there are no matches. If more than one Rule instance matches, they must be returned in the order originally registered through the add() method. @param nam

(String namespaceURI, String pattern)

Source from the content-addressed store, hash-verified

133 * @param pattern Nesting pattern to be matched
134 */
135 @Override
136 public List<Rule> match(String namespaceURI, String pattern) {
137
138 // List rulesList = (List) this.cache.get(pattern);
139 List<Rule> rulesList = lookup(namespaceURI, pattern);
140 if ((rulesList == null) || (rulesList.isEmpty())) {
141 // Find the longest key, ie more discriminant
142 String longKey = "";
143 for (String key : this.cache.keySet()) {
144 if (key.startsWith("*/")) {
145 if (pattern.equals(key.substring(2)) || pattern.endsWith(key.substring(1))) {
146 if (key.length() > longKey.length()) {
147 // rulesList = (List) this.cache.get(key);
148 rulesList = lookup(namespaceURI, key);
149 longKey = key;
150 }
151 }
152 }
153 }
154 }
155 if (rulesList == null) {
156 rulesList = new ArrayList<>();
157 }
158 return rulesList;
159 }
160
161
162 /**

Callers

nothing calls this directly

Calls 7

lookupMethod · 0.95
endsWithMethod · 0.80
lengthMethod · 0.80
equalsMethod · 0.65
isEmptyMethod · 0.45
keySetMethod · 0.45
startsWithMethod · 0.45

Tested by

no test coverage detected