@@ -171,20 +171,17 @@ public MatchedResource<E> getMatched(String path)
171
171
if (_optimizedExact )
172
172
{
173
173
int i = path .length ();
174
-
175
- final Trie <MappedResource <E >> exact_map = _exactMap ;
176
174
while (i >= 0 )
177
175
{
178
- MappedResource <E > candidate = exact_map .getBest (path , 0 , i );
176
+ MappedResource <E > candidate = _exactMap .getBest (path , 0 , i -- );
179
177
if (candidate == null )
180
- break ;
178
+ continue ;
181
179
182
180
matchedPath = candidate .getPathSpec ().matched (path );
183
181
if (matchedPath != null )
184
182
{
185
183
return new MatchedResource <>(candidate .getResource (), candidate .getPathSpec (), matchedPath );
186
184
}
187
- i --;
188
185
}
189
186
// If we reached here, there's NO optimized EXACT Match possible, skip simple match below
190
187
skipRestOfGroup = true ;
@@ -197,17 +194,15 @@ public MatchedResource<E> getMatched(String path)
197
194
if (_optimizedPrefix )
198
195
{
199
196
int i = path .length ();
200
- final Trie <MappedResource <E >> prefix_map = _prefixMap ;
201
197
while (i >= 0 )
202
198
{
203
- MappedResource <E > candidate = prefix_map .getBest (path , 0 , i );
199
+ MappedResource <E > candidate = _prefixMap .getBest (path , 0 , i -- );
204
200
if (candidate == null )
205
- break ;
201
+ continue ;
206
202
207
203
matchedPath = candidate .getPathSpec ().matched (path );
208
204
if (matchedPath != null )
209
205
return new MatchedResource <>(candidate .getResource (), candidate .getPathSpec (), matchedPath );
210
- i --;
211
206
}
212
207
// If we reached here, there's NO optimized PREFIX Match possible, skip simple match below
213
208
skipRestOfGroup = true ;
@@ -220,12 +215,16 @@ public MatchedResource<E> getMatched(String path)
220
215
if (_optimizedSuffix )
221
216
{
222
217
int i = 0 ;
223
- final Trie <MappedResource <E >> suffix_map = _suffixMap ;
218
+ // Loop through each suffix mark
219
+ // Input is "/a.b.c.foo"
220
+ // Loop 1: "b.c.foo"
221
+ // Loop 2: "c.foo"
222
+ // Loop 3: "foo"
224
223
while ((i = path .indexOf ('.' , i + 1 )) > 0 )
225
224
{
226
- MappedResource <E > candidate = suffix_map .get (path , i + 1 , path .length () - i - 1 );
225
+ MappedResource <E > candidate = _suffixMap .get (path , i + 1 , path .length () - i - 1 );
227
226
if (candidate == null )
228
- break ;
227
+ continue ;
229
228
230
229
matchedPath = candidate .getPathSpec ().matched (path );
231
230
if (matchedPath != null )
0 commit comments