File tree 2 files changed +7
-7
lines changed
log4j-core/src/main/java/org/apache/logging/log4j/core/filter
log4j-core-test/src/test/java/org/apache/logging/log4j/core/filter
2 files changed +7
-7
lines changed Original file line number Diff line number Diff line change 40
40
class RegexFilterTest {
41
41
@ BeforeAll
42
42
static void before () {
43
- StatusLogger .getLogger ().setLevel (Level .OFF );
43
+ StatusLogger .getLogger ().getFallbackListener (). setLevel (Level .OFF );
44
44
}
45
45
46
46
@ Test
@@ -152,8 +152,6 @@ void testWithValidRegex() {
152
152
.setOnMatch (Result .ACCEPT )
153
153
.setOnMismatch (Result .DENY );
154
154
155
- assertTrue (builder .isValid ());
156
-
157
155
final RegexFilter filter = builder .build ();
158
156
159
157
assertNotNull (filter );
@@ -195,8 +193,6 @@ void testBuilderWithoutRegexNotValid() {
195
193
196
194
final RegexFilter .Builder builder = RegexFilter .newBuilder ();
197
195
198
- assertFalse (builder .isValid ());
199
-
200
196
assertNull (builder .build ());
201
197
}
202
198
@@ -210,8 +206,6 @@ void testBuilderWithInvalidRegexNotValid() {
210
206
211
207
builder .setRegex ("[a-z" );
212
208
213
- assertFalse (builder .isValid ());
214
-
215
209
assertNull (builder .build ());
216
210
}
217
211
}
Original file line number Diff line number Diff line change @@ -308,6 +308,12 @@ public Builder setUseRawMsg(final boolean useRawMsg) {
308
308
return this ;
309
309
}
310
310
311
+ /** {@inheritDoc} */
312
+ @ Override
313
+ public boolean isValid () {
314
+ return (Strings .isNotEmpty (this .regex ));
315
+ }
316
+
311
317
/**
312
318
* Builds and returns a {@link RegexFilter} instance configured by this builder.
313
319
*
You can’t perform that action at this time.
0 commit comments