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 2018/07/16 00:27:08 UTC

logging-log4j2 git commit: Assume the call site knows what it is doing.

Repository: logging-log4j2
Updated Branches:
  refs/heads/release-2.x 06bbc41b4 -> 976630af7


Assume the call site knows what it is doing.

Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/976630af
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/976630af
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/976630af

Branch: refs/heads/release-2.x
Commit: 976630af722f34b757a060d067c6877f3fbea589
Parents: 06bbc41
Author: Gary Gregory <ga...@gmail.com>
Authored: Sun Jul 15 18:27:05 2018 -0600
Committer: Gary Gregory <ga...@gmail.com>
Committed: Sun Jul 15 18:27:05 2018 -0600

----------------------------------------------------------------------
 .../java/org/apache/logging/log4j/junit/LoggerContextRule.java  | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/976630af/log4j-core/src/test/java/org/apache/logging/log4j/junit/LoggerContextRule.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/junit/LoggerContextRule.java b/log4j-core/src/test/java/org/apache/logging/log4j/junit/LoggerContextRule.java
index c0c0def..2d591d3 100644
--- a/log4j-core/src/test/java/org/apache/logging/log4j/junit/LoggerContextRule.java
+++ b/log4j-core/src/test/java/org/apache/logging/log4j/junit/LoggerContextRule.java
@@ -145,8 +145,9 @@ public class LoggerContextRule implements TestRule, LoggerContextAccessor {
      *            the name of the Appender to look up.
      * @return the named Appender or {@code null} if it wasn't defined in the configuration.
      */
-    public Appender getAppender(final String name) {
-        return getConfiguration().getAppenders().get(name);
+    @SuppressWarnings("unchecked") // Assume the call site knows what it is doing.
+	public <T extends Appender> T getAppender(final String name) {
+        return (T) getConfiguration().getAppenders().get(name);
     }
 
     /**