Skip to content

Commit

Permalink
Revert "[UNDERTOW-1748] add comment line to predicates"
Browse files Browse the repository at this point in the history
This reverts commit 223be0f.
  • Loading branch information
fl4via committed Feb 14, 2023
1 parent 6da238e commit 157bcff
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -647,23 +647,6 @@ public static Deque<Token> tokenize(final String string) {
}
} else {
switch (c) {
case '#':
final Token previous = ret.peekLast();
if(previous == null ||(previous != null && previous.getToken().equals("\n"))) {
//its either first line ever or new line
pos++;
while (pos < string.length()) {
char skip = string.charAt(pos);
if(skip == '\n' || skip == '\r') {
break;
}
pos++;
}
break;
} else {
current.append(c);
break;
}
case ' ':
case '\t': {
if (current.length() != 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,12 @@ public void testPredicateContextVariable() {

@Test
public void testRegularExpressionsWithPredicateContext() {
Predicate predicate = PredicateParser.parse("#Im Not related\nregex[pattern=#a* , value=%{RELATIVE_PATH}] and equals[{$0, #aaa}]", PredicateParsingTestCase.class.getClassLoader());
Predicate predicate = PredicateParser.parse("regex[pattern=a* , value=%{RELATIVE_PATH}] and equals[{$0, aaa}]", PredicateParsingTestCase.class.getClassLoader());
HttpServerExchange e = new HttpServerExchange(null);
e.putAttachment(Predicate.PREDICATE_CONTEXT, new HashMap<String, Object>());
e.setRelativePath("#aaab");
e.setRelativePath("aaab");
Assert.assertTrue(predicate.resolve(e));
e.setRelativePath("#aaaab");
e.setRelativePath("aaaab");
Assert.assertFalse(predicate.resolve(e));

predicate = PredicateParser.parse("regex[pattern='a(b*)a*' , value=%{RELATIVE_PATH}] and equals[$1, bb]", PredicateParsingTestCase.class.getClassLoader());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ public void testRewrite() throws IOException {
"regex('(.*).css') -> {rewrite['${1}.xcss'];set(attribute='%{o,chained}', value=true)} \n" +
"regex('(.*).redirect$') -> redirect['${1}.redirected']\n\n\n\n\n" +
"set[attribute='%{o,someHeader}', value=always]\n" +
"#ImJust a Comment\n"+
"path-template('/foo/{bar}/{f}') -> set[attribute='%{o,template}', value='${bar}']\r\n" +
"path-template('/bar->foo') -> redirect(/);" +
"regex('(.*).css') -> set[attribute='%{o,css}', value='true'] else set[attribute='%{o,css}', value='false']; " +
Expand Down

0 comments on commit 157bcff

Please sign in to comment.