You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by pk...@apache.org on 2023/11/16 08:23:57 UTC
(logging-log4j2) 11/11: Fix compilation errors and remove deprecated methods
This is an automated email from the ASF dual-hosted git repository.
pkarwasz pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/logging-log4j2.git
commit b7f2c4cb9c1e35ad5aa555fbac183b4d94de3ea0
Author: Piotr P. Karwasz <pi...@karwasz.org>
AuthorDate: Thu Nov 16 09:20:08 2023 +0100
Fix compilation errors and remove deprecated methods
---
.../apache/logging/log4j/message/ParameterizedMessage.java | 2 +-
.../org/apache/logging/log4j/message/StructuredDataId.java | 14 --------------
.../java/org/apache/logging/log4j/util/PropertySource.java | 8 +++-----
.../org/apache/logging/log4j/core/async/DisruptorUtil.java | 5 +++--
4 files changed, 7 insertions(+), 22 deletions(-)
diff --git a/log4j-api/src/main/java/org/apache/logging/log4j/message/ParameterizedMessage.java b/log4j-api/src/main/java/org/apache/logging/log4j/message/ParameterizedMessage.java
index 8410707b18..b6b0b2ff64 100644
--- a/log4j-api/src/main/java/org/apache/logging/log4j/message/ParameterizedMessage.java
+++ b/log4j-api/src/main/java/org/apache/logging/log4j/message/ParameterizedMessage.java
@@ -230,7 +230,7 @@ public class ParameterizedMessage implements Message, StringBuilderFormattable {
return false;
}
final ParameterizedMessage that = (ParameterizedMessage) object;
- return Objects.equals(pattern, that.pattern) && Arrays.equals(args, that.args);
+ return Objects.equals(this.messagePattern, that.messagePattern) && Arrays.equals(this.argArray, that.argArray);
}
@Override
diff --git a/log4j-api/src/main/java/org/apache/logging/log4j/message/StructuredDataId.java b/log4j-api/src/main/java/org/apache/logging/log4j/message/StructuredDataId.java
index cf4c7b49d6..25b391f976 100644
--- a/log4j-api/src/main/java/org/apache/logging/log4j/message/StructuredDataId.java
+++ b/log4j-api/src/main/java/org/apache/logging/log4j/message/StructuredDataId.java
@@ -201,20 +201,6 @@ public class StructuredDataId implements StringBuilderFormattable {
return new StructuredDataId(id, anEnterpriseNumber, req, opt);
}
- /**
- * Creates an id based on the current id.
- *
- * @param defaultId The default id to use if this StructuredDataId doesn't have a name.
- * @param anEnterpriseNumber The enterprise number.
- * @return a StructuredDataId.
- * @deprecated Use {@link StructuredDataId#makeId(String, String)} instead
- */
- @Deprecated
- @InlineMe(replacement = "this.makeId(defaultId, String.valueOf(anEnterpriseNumber))")
- public StructuredDataId makeId(final String defaultId, final int anEnterpriseNumber) {
- return makeId(defaultId, String.valueOf(anEnterpriseNumber));
- }
-
/**
* Returns a list of required keys.
*
diff --git a/log4j-api/src/main/java/org/apache/logging/log4j/util/PropertySource.java b/log4j-api/src/main/java/org/apache/logging/log4j/util/PropertySource.java
index 8f6b4b434a..6af0c05122 100644
--- a/log4j-api/src/main/java/org/apache/logging/log4j/util/PropertySource.java
+++ b/log4j-api/src/main/java/org/apache/logging/log4j/util/PropertySource.java
@@ -139,12 +139,10 @@ public interface PropertySource {
* @param value property name
* @return the property broken into lower case tokens
*/
- // https://errorprone.info/bugpattern/CollectionUndefinedEquality
- @SuppressWarnings("CollectionUndefinedEquality")
public static List<CharSequence> tokenize(final CharSequence value) {
- // `value` should be a `String`
- if (CACHE.containsKey(value.toString())) {
- return CACHE.get(value.toString());
+ final String key = value.toString();
+ if (CACHE.containsKey(key)) {
+ return CACHE.get(key);
}
final List<CharSequence> tokens = List.of(key.split("[._/]+"));
CACHE.put(key, tokens);
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/async/DisruptorUtil.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/async/DisruptorUtil.java
index 9f3e390221..3fe334aedd 100644
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/async/DisruptorUtil.java
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/async/DisruptorUtil.java
@@ -16,10 +16,11 @@
*/
package org.apache.logging.log4j.core.async;
-import com.lmax.disruptor.ExceptionHandler;
-import com.lmax.disruptor.WaitStrategy;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Future;
+
+import com.lmax.disruptor.ExceptionHandler;
+import com.lmax.disruptor.WaitStrategy;
import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.core.impl.Log4jPropertyKey;
import org.apache.logging.log4j.core.util.Integers;