You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by gg...@apache.org on 2021/12/30 13:20:41 UTC

[logging-log4j2] branch release-2.x updated (8c1ea14 -> 7f4a9b6)

This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a change to branch release-2.x
in repository https://gitbox.apache.org/repos/asf/logging-log4j2.git.


    from 8c1ea14  Add script for verifying release signatures and hashes.
     new a8134db  Log4j 1.2 bridge method NDC.inherit(Stack) should not use generics to provide source compatibility.
     new 7f4a9b6  Log4j 1.2 bridge method NDC.inherit(Stack) should not use generics to provide source compatibility.

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 log4j-1.2-api/src/main/java/org/apache/log4j/NDC.java     | 11 ++++++-----
 log4j-1.2-api/src/test/java/org/apache/log4j/NDCTest.java | 12 ++++++++++++
 src/changes/changes.xml                                   |  5 ++++-
 3 files changed, 22 insertions(+), 6 deletions(-)

[logging-log4j2] 01/02: Log4j 1.2 bridge method NDC.inherit(Stack) should not use generics to provide source compatibility.

Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch release-2.x
in repository https://gitbox.apache.org/repos/asf/logging-log4j2.git

commit a8134db306c36a88b1a334449170a03cc88d582b
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Thu Dec 30 08:20:28 2021 -0500

    Log4j 1.2 bridge method NDC.inherit(Stack) should not use generics to
    provide source compatibility.
---
 log4j-1.2-api/src/main/java/org/apache/log4j/NDC.java     | 11 ++++++-----
 log4j-1.2-api/src/test/java/org/apache/log4j/NDCTest.java | 12 ++++++++++++
 2 files changed, 18 insertions(+), 5 deletions(-)

diff --git a/log4j-1.2-api/src/main/java/org/apache/log4j/NDC.java b/log4j-1.2-api/src/main/java/org/apache/log4j/NDC.java
index a4e23dc..72efe04 100644
--- a/log4j-1.2-api/src/main/java/org/apache/log4j/NDC.java
+++ b/log4j-1.2-api/src/main/java/org/apache/log4j/NDC.java
@@ -19,7 +19,7 @@ package org.apache.log4j;
 import java.util.Stack;
 
 /**
- *
+ * <em>This class does not use generics to provide better source compatibility.</em>
  */
 public final class NDC {
 
@@ -52,7 +52,7 @@ public final class NDC {
      * The child thread uses the {@link #inherit inherit} method to
      * inherit the parent's diagnostic context.
      * </p>
-     * @return Stack A clone of the current thread's  diagnostic context.
+     * @return Stack A clone of the current thread's diagnostic context, Stack of Strings.
      */
     @SuppressWarnings("rawtypes")
     public static Stack cloneStack() {
@@ -65,7 +65,7 @@ public final class NDC {
 
 
     /**
-     * Inherit the diagnostic context of another thread.
+     * Inherit the diagnostic context of another thread, a Stack of Strings.
      * <p>
      * The parent thread can obtain a reference to its diagnostic
      * context using the {@link #cloneStack} method.  It should
@@ -83,9 +83,10 @@ public final class NDC {
      * there is no client-transparent way of inheriting diagnostic
      * contexts. Do you know any solution to this problem?
      * </p>
-     * @param stack The diagnostic context of the parent thread.
+     * @param stack The diagnostic context of the parent thread, a Stack of Strings.
      */
-    public static void inherit(final Stack<String> stack) {
+    @SuppressWarnings({"rawtypes", "unchecked"})
+    public static void inherit(final Stack stack) {
         org.apache.logging.log4j.ThreadContext.setStack(stack);
     }
 
diff --git a/log4j-1.2-api/src/test/java/org/apache/log4j/NDCTest.java b/log4j-1.2-api/src/test/java/org/apache/log4j/NDCTest.java
index c8baf0f..41ba015 100644
--- a/log4j-1.2-api/src/test/java/org/apache/log4j/NDCTest.java
+++ b/log4j-1.2-api/src/test/java/org/apache/log4j/NDCTest.java
@@ -16,6 +16,8 @@
  */
 package org.apache.log4j;
 
+import java.util.Stack;
+
 import org.apache.logging.log4j.util.Strings;
 import org.junit.Assert;
 import org.junit.Test;
@@ -33,4 +35,14 @@ public class NDCTest {
         NDC.clear();
         Assert.assertEquals(Strings.EMPTY, NDC.peek());
     }
+    
+    @SuppressWarnings({"rawtypes"})
+    @Test
+    public void testCompileCloneToInherit() {
+        NDC.inherit(NDC.cloneStack());
+        final Stack stackRaw = NDC.cloneStack();
+        NDC.inherit(stackRaw);
+        final Stack<?> stackAny = NDC.cloneStack();
+        NDC.inherit(stackAny);
+    }
 }

[logging-log4j2] 02/02: Log4j 1.2 bridge method NDC.inherit(Stack) should not use generics to provide source compatibility.

Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch release-2.x
in repository https://gitbox.apache.org/repos/asf/logging-log4j2.git

commit 7f4a9b65a3969e38d117680a22f86070bc7f6c34
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Thu Dec 30 08:20:37 2021 -0500

    Log4j 1.2 bridge method NDC.inherit(Stack) should not use generics to
    provide source compatibility.
---
 src/changes/changes.xml | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index d6d29fa..441192f 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -32,7 +32,10 @@
     <release version="2.17.2" date="20YY-MM-DD" description="GA Release 2.17.2">
       <!-- FIXES -->
       <action dev="ggregory" type="fix">
-		Log4j 1.2 bridge class ConsoleAppender should extend WriterAppender and provide better compatibility with custom appenders.
+        Log4j 1.2 bridge class ConsoleAppender should extend WriterAppender and provide better compatibility with custom appenders.
+      </action>
+      <action dev="ggregory" type="fix">
+        Log4j 1.2 bridge method NDC.inherit(Stack) should not use generics to provide source compatibility.
       </action>
 	</release>
     <release version="2.17.1" date="2021-12-27" description="GA Release 2.17.1">