Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertSame;
import static org.junit.jupiter.api.Assertions.assertTrue;
Expand Down Expand Up @@ -110,4 +111,11 @@ public void testParameterizedMsg() throws Exception {
final Result fmtResult = fmtFilter.filter(null, null, null, msg, params);
assertThat(fmtResult, equalTo(Result.ACCEPT));
}

@Test
void testRegexFilterDoesNotThrowWithAllTheParametersExceptRegexEqualNull() {
assertDoesNotThrow(() -> {
RegexFilter.createFilter(".* test .*", null, null, null, null);
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,11 @@ public static RegexFilter createFilter(
LOGGER.error("A regular expression must be provided for RegexFilter");
return null;
}
return new RegexFilter(useRawMsg, Pattern.compile(regex, toPatternFlags(patternFlags)), onMatch, onMismatch);
return new RegexFilter(
Boolean.TRUE.equals(useRawMsg),
Pattern.compile(regex, toPatternFlags(patternFlags)),
onMatch,
onMismatch);
}

private static int toPatternFlags(final String[] patternFlags)
Expand Down