Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add missing setter in builder classes #3174

Merged
merged 1 commit into from
Nov 17, 2024
Merged
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 @@ -86,7 +86,7 @@ private Filter createFilter(final String text, final boolean acceptOnMatch) {
? org.apache.logging.log4j.core.Filter.Result.ACCEPT
: org.apache.logging.log4j.core.Filter.Result.DENY;
return FilterWrapper.adapt(StringMatchFilter.newBuilder()
.setMatchString(text)
.setText(text)
.setOnMatch(onMatch)
.setOnMismatch(org.apache.logging.log4j.core.Filter.Result.NEUTRAL)
.build());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public void testFilterBuilderFailsWithNullText() {
@Test
void testFilterBuilderFailsWithExceptionOnNullText() {
Assertions.assertThrows(IllegalArgumentException.class, () -> StringMatchFilter.newBuilder()
.setMatchString(null));
.setText(null));
}

/**
Expand All @@ -56,7 +56,7 @@ void testFilterBuilderFailsWithExceptionOnNullText() {
@Test
void testFilterBuilderFailsWithExceptionOnEmptyText() {
Assertions.assertThrows(IllegalArgumentException.class, () -> StringMatchFilter.newBuilder()
.setMatchString(""));
.setText(""));
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -242,12 +242,23 @@ public static class Builder extends AbstractFilterBuilder<StringMatchFilter.Buil
@Required(message = "No text provided for StringMatchFilter")
private String text;

/**
* @deprecated since 2.25.0, use {@link #setText} instead.
*/
@Deprecated
public StringMatchFilter.Builder setMatchString(final String text) {
this.text = Assert.requireNonEmpty(text, "The 'text' argument must not be null or empty.");
return this;
}

/**
* Sets the text to search in event messages.
*
* @param text the text to search in event messages.
* @return this instance.
* @since 2.25.0
*/
public StringMatchFilter.Builder setMatchString(final String text) {
public StringMatchFilter.Builder setText(final String text) {
this.text = Assert.requireNonEmpty(text, "The 'text' argument must not be null or empty.");
return this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
* {@link org.apache.logging.log4j.core.Filter#ELEMENT_TYPE filter}.
*/
@Export
@Version("2.21.1")
@Version("2.25.0")
package org.apache.logging.log4j.core.filter;

import org.osgi.annotation.bundle.Export;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,30 @@ public B setMapPrefix(final String prefix) {
}
return asBuilder();
}

/**
* @since 2.25.0
*/
public B setThreadContextIncludes(String threadContextIncludes) {
this.threadContextIncludes = threadContextIncludes;
return asBuilder();
}

/**
* @since 2.25.0
*/
public B setThreadContextExcludes(String threadContextExcludes) {
this.threadContextExcludes = threadContextExcludes;
return asBuilder();
}

/**
* @since 2.25.0
*/
public B setOmitEmptyFields(boolean omitEmptyFields) {
this.omitEmptyFields = omitEmptyFields;
return asBuilder();
}
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -850,6 +850,14 @@ public Rfc5424LayoutBuilder setLoggerFields(final LoggerFields[] loggerFields) {
return this;
}

/**
* @since 2.25.0
*/
public Rfc5424LayoutBuilder setEnterpriseNumber(Integer enterpriseNumber) {
this.enterpriseNumber = enterpriseNumber;
return this;
}

@Override
public Rfc5424Layout build() {
if (includes != null && excludes != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
* {@link org.apache.logging.log4j.core.Layout#ELEMENT_TYPE layout}.
*/
@Export
@Version("2.24.0")
@Version("2.25.0")
package org.apache.logging.log4j.core.layout;

import org.osgi.annotation.bundle.Export;
Expand Down