logging-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rgo...@apache.org
Subject svn commit: r1476703 [1/4] - in /logging/log4j/log4j2/trunk: ./ api/ core/ core/src/main/java/org/apache/logging/log4j/core/appender/ core/src/main/java/org/apache/logging/log4j/core/appender/rewrite/ core/src/main/java/org/apache/logging/log4j/core/ap...
Date Sun, 28 Apr 2013 01:27:29 GMT
Author: rgoers
Date: Sun Apr 28 01:27:27 2013
New Revision: 1476703

URL: http://svn.apache.org/r1476703
Log:
LOG4J2-221 - Remove hundreds of compiler warnings

Modified:
    logging/log4j/log4j2/trunk/BUILDING.txt
    logging/log4j/log4j2/trunk/api/pom.xml
    logging/log4j/log4j2/trunk/core/build.xml
    logging/log4j/log4j2/trunk/core/pom.xml
    logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/AbstractAppender.java
    logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/AbstractManager.java
    logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/AbstractOutputStreamAppender.java
    logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/AsynchAppender.java
    logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/ConsoleAppender.java
    logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/FailoverAppender.java
    logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/FastFileAppender.java
    logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/FastRollingFileAppender.java
    logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/FileAppender.java
    logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/JMSQueueAppender.java
    logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/JMSTopicAppender.java
    logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/RollingFileAppender.java
    logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/SMTPAppender.java
    logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/SocketAppender.java
    logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/SyslogAppender.java
    logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/rewrite/RewriteAppender.java
    logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/routing/RoutingAppender.java
    logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/config/BaseConfiguration.java
    logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/config/ConfigurationFactory.java
    logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/config/DefaultConfiguration.java
    logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/config/JSONConfiguration.java
    logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/config/LoggerConfig.java
    logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/config/XMLConfiguration.java
    logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/config/plugins/PluginManager.java
    logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/config/plugins/ResolverUtil.java
    logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/impl/ThrowableProxy.java
    logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/lookup/Interpolator.java
    logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/pattern/PatternParser.java
    logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/dumbster/smtp/SimpleSmtpServer.java
    logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/dumbster/smtp/SmtpMessage.java
    logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/AppenderRefLevelTest.java
    logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/LoggerTest.java
    logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/StrictXMLConfigTest.java
    logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/AsynchAppenderNoLocationTest.java
    logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/AsynchAppenderTest.java
    logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/ConsoleAppenderTest.java
    logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/FailoverAppenderTest.java
    logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/FileAppenderTest.java
    logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/OutputStreamAppenderTest.java
    logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/SocketAppenderTest.java
    logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/SyslogAppenderTest.java
    logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/rewrite/RewriteAppenderTest.java
    logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/rewrite/TestRewritePolicy.java
    logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/routing/JSONRoutingAppender2Test.java
    logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/routing/JSONRoutingAppenderTest.java
    logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/routing/RoutingAppenderTest.java
    logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/PerfTestDriver.java
    logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/PerfTestResultFormatter.java
    logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/XMLConfigurationTest.java
    logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/XMLLoggerPropsTest.java
    logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/filter/BurstFilterTest.java
    logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/filter/MapFilterTest.java
    logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/filter/StructuredDataFilterTest.java
    logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/filter/TimeFilterTest.java
    logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/layout/HTMLLayoutTest.java
    logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/layout/RFC5424LayoutTest.java
    logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/layout/SerializedLayoutTest.java
    logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/layout/SyslogLayoutTest.java
    logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/layout/XMLLayoutTest.java
    logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/net/JMSQueueFailoverTest.java
    logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/net/JMSQueueTest.java
    logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/net/JMSTopicFailoverTest.java
    logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/net/JMSTopicTest.java
    logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/net/SocketMessageLossTest.java
    logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/net/SocketReconnectTest.java
    logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/net/SocketServerTest.java
    logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/net/SocketTest.java
    logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/pattern/ExtendedThrowableTest.java
    logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/pattern/RegexReplacementTest.java
    logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/pattern/RootThrowableTest.java
    logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/pattern/StyleConverterTest.java
    logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/pattern/ThrowableTest.java
    logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/util/Profiler.java
    logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/test/appender/AlwaysFailAppender.java
    logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/test/appender/FailOnceAppender.java
    logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/test/appender/InMemoryAppender.java
    logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/test/appender/ListAppender.java
    logging/log4j/log4j2/trunk/flume-ng/pom.xml
    logging/log4j/log4j2/trunk/flume-ng/src/main/java/org/apache/logging/log4j/flume/appender/FlumeAppender.java
    logging/log4j/log4j2/trunk/flume-ng/src/main/java/org/apache/logging/log4j/flume/appender/FlumeAvroManager.java
    logging/log4j/log4j2/trunk/flume-ng/src/main/java/org/apache/logging/log4j/flume/appender/FlumeEmbeddedManager.java
    logging/log4j/log4j2/trunk/jcl-bridge/pom.xml
    logging/log4j/log4j2/trunk/jcl-bridge/src/test/java/org/apache/logging/log4j/jcl/LoggerTest.java
    logging/log4j/log4j2/trunk/log4j-to-slf4j/pom.xml
    logging/log4j/log4j2/trunk/log4j-to-slf4j/src/main/java/org/apache/logging/slf4j/MDCContextMap.java
    logging/log4j/log4j2/trunk/log4j12-api/pom.xml
    logging/log4j/log4j2/trunk/log4j12-api/src/main/java/org/apache/log4j/MDC.java
    logging/log4j/log4j2/trunk/log4j12-api/src/main/java/org/apache/log4j/NDC.java
    logging/log4j/log4j2/trunk/log4j12-api/src/test/java/org/apache/log4j/CategoryTest.java
    logging/log4j/log4j2/trunk/log4j12-api/src/test/java/org/apache/log4j/LoggerTest.java
    logging/log4j/log4j2/trunk/log4j12-api/src/test/java/org/apache/log4j/PriorityTest.java
    logging/log4j/log4j2/trunk/samples/flume-common/src/main/java/org/apache/logging/log4j/samples/app/LogEventFactory.java
    logging/log4j/log4j2/trunk/slf4j-impl/pom.xml
    logging/log4j/log4j2/trunk/slf4j-impl/src/main/java/org/slf4j/helpers/Log4JLoggerFactory.java
    logging/log4j/log4j2/trunk/slf4j-impl/src/main/java/org/slf4j/helpers/Log4JMDCAdapter.java
    logging/log4j/log4j2/trunk/slf4j-impl/src/main/java/org/slf4j/helpers/Log4JMarkerFactory.java
    logging/log4j/log4j2/trunk/slf4j-impl/src/main/java/org/slf4j/helpers/MarkerWrapper.java
    logging/log4j/log4j2/trunk/slf4j-impl/src/main/java/org/slf4j/impl/SLF4JLogger.java
    logging/log4j/log4j2/trunk/slf4j-impl/src/main/java/org/slf4j/impl/StaticLoggerBinder.java
    logging/log4j/log4j2/trunk/slf4j-impl/src/main/java/org/slf4j/impl/StaticMarkerBinder.java
    logging/log4j/log4j2/trunk/slf4j-impl/src/test/java/org/apache/logging/slf4j/LoggerTest.java
    logging/log4j/log4j2/trunk/src/changes/changes.xml
    logging/log4j/log4j2/trunk/src/site/xdoc/manual/api.xml
    logging/log4j/log4j2/trunk/src/site/xdoc/manual/thread-context.xml
    logging/log4j/log4j2/trunk/taglib/pom.xml
    logging/log4j/log4j2/trunk/taglib/src/test/java/org/apache/logging/log4j/taglib/CatchingTagTest.java
    logging/log4j/log4j2/trunk/taglib/src/test/java/org/apache/logging/log4j/taglib/EntryTagTest.java
    logging/log4j/log4j2/trunk/taglib/src/test/java/org/apache/logging/log4j/taglib/ExitTagTest.java
    logging/log4j/log4j2/trunk/taglib/src/test/java/org/apache/logging/log4j/taglib/LoggingMessageTagSupportTest.java
    logging/log4j/log4j2/trunk/web/pom.xml
    logging/log4j/log4j2/trunk/web/src/main/java/org/apache/logging/log4j/core/web/Log4jContextListener.java
    logging/log4j/log4j2/trunk/web/src/test/java/org/apache/logging/log4j/core/web/Log4jContextListenerTest.java

Modified: logging/log4j/log4j2/trunk/BUILDING.txt
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/BUILDING.txt?rev=1476703&r1=1476702&r2=1476703&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/BUILDING.txt (original)
+++ logging/log4j/log4j2/trunk/BUILDING.txt Sun Apr 28 01:27:27 2013
@@ -1,6 +1,6 @@
 Building Log4J 2
   
-To build Log4J 2, you need a JDK implementation version 1.5 or greater, and Apache Maven.
+To build Log4J 2, you need a JDK implementation version 1.6 or greater, and Apache Maven.
 
 To build the site, from a command line, run:
 

Modified: logging/log4j/log4j2/trunk/api/pom.xml
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/api/pom.xml?rev=1476703&r1=1476702&r2=1476703&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/api/pom.xml (original)
+++ logging/log4j/log4j2/trunk/api/pom.xml Sun Apr 28 01:27:27 2013
@@ -150,7 +150,7 @@
         <artifactId>maven-pmd-plugin</artifactId>
         <version>${pmd.plugin.version}</version>
         <configuration>
-          <targetJdk>1.5</targetJdk>
+          <targetJdk>${maven.compile.target}</targetJdk>
         </configuration>
       </plugin>
       <plugin>

Modified: logging/log4j/log4j2/trunk/core/build.xml
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/build.xml?rev=1476703&r1=1476702&r2=1476703&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/build.xml (original)
+++ logging/log4j/log4j2/trunk/core/build.xml Sun Apr 28 01:27:27 2013
@@ -50,8 +50,8 @@ Use of Maven to build this component is 
        
 
     <!--   Java compiler settings   -->
-    <property name="javac.source" value="1.5"/>
-    <property name="javac.target" value="1.5"/>
+    <property name="javac.source" value="1.6"/>
+    <property name="javac.target" value="1.6"/>
     <property name="javac.deprecation" value="true"/>
     <property name="javac.debug" value="true"/>
        

Modified: logging/log4j/log4j2/trunk/core/pom.xml
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/pom.xml?rev=1476703&r1=1476702&r2=1476703&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/pom.xml (original)
+++ logging/log4j/log4j2/trunk/core/pom.xml Sun Apr 28 01:27:27 2013
@@ -297,7 +297,7 @@
         <artifactId>maven-pmd-plugin</artifactId>
         <version>${pmd.plugin.version}</version>
         <configuration>
-          <targetJdk>1.5</targetJdk>
+          <targetJdk>${maven.compile.target}</targetJdk>
         </configuration>
       </plugin>
       <plugin>

Modified: logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/AbstractAppender.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/AbstractAppender.java?rev=1476703&r1=1476702&r2=1476703&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/AbstractAppender.java (original)
+++ logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/AbstractAppender.java Sun Apr 28 01:27:27 2013
@@ -16,17 +16,17 @@
  */
 package org.apache.logging.log4j.core.appender;
 
-import java.io.Serializable;
-
+import org.apache.logging.log4j.Logger;
 import org.apache.logging.log4j.core.Appender;
 import org.apache.logging.log4j.core.ErrorHandler;
 import org.apache.logging.log4j.core.Filter;
+import org.apache.logging.log4j.core.Layout;
 import org.apache.logging.log4j.core.LifeCycle;
 import org.apache.logging.log4j.core.LogEvent;
-import org.apache.logging.log4j.core.Layout;
 import org.apache.logging.log4j.core.filter.AbstractFilterable;
 import org.apache.logging.log4j.status.StatusLogger;
-import org.apache.logging.log4j.Logger;
+
+import java.io.Serializable;
 
 /**
  * Abstract base class for Appenders. Although Appenders do not have to extend this class, doing so
@@ -84,6 +84,7 @@ public abstract class AbstractAppender<T
      * Returns the ErrorHandler, if any.
      * @return The ErrorHandler.
      */
+    @Override
     public ErrorHandler getHandler() {
         return handler;
     }
@@ -92,6 +93,7 @@ public abstract class AbstractAppender<T
      * The handler must be set before the appender is started.
      * @param handler The ErrorHandler to use.
      */
+    @Override
     public void setHandler(final ErrorHandler handler) {
         if (handler == null) {
             LOGGER.error("The handler cannot be set to null");
@@ -114,6 +116,7 @@ public abstract class AbstractAppender<T
      * Returns the name of the Appender.
      * @return The name of the Appender.
      */
+    @Override
     public String getName() {
         return name;
     }
@@ -122,6 +125,7 @@ public abstract class AbstractAppender<T
      * Returns the Layout for the appender.
      * @return The Layout used to format the event.
      */
+    @Override
     public Layout<T> getLayout() {
         return layout;
     }
@@ -131,6 +135,7 @@ public abstract class AbstractAppender<T
      * AppenderControl will allow the exception to percolate.
      * @return true if exceptions will be suppressed, false otherwise.
      */
+    @Override
     public boolean isExceptionSuppressed() {
         return handleException;
     }
@@ -138,6 +143,7 @@ public abstract class AbstractAppender<T
     /**
      * Start the Appender.
      */
+    @Override
     public void start() {
         startFilter();
         this.started = true;
@@ -146,6 +152,7 @@ public abstract class AbstractAppender<T
     /**
      * Stop the Appender.
      */
+    @Override
     public void stop() {
         this.started = false;
         stopFilter();
@@ -155,6 +162,7 @@ public abstract class AbstractAppender<T
      * Returns true if the Appender is started, false otherwise.
      * @return true if the Appender is started, false otherwise.
      */
+    @Override
     public boolean isStarted() {
         return started;
     }

Modified: logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/AbstractManager.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/AbstractManager.java?rev=1476703&r1=1476702&r2=1476703&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/AbstractManager.java (original)
+++ logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/AbstractManager.java Sun Apr 28 01:27:27 2013
@@ -65,6 +65,7 @@ public abstract class AbstractManager {
                                                               final T data) {
         LOCK.lock();
         try {
+            @SuppressWarnings("unchecked")
             M manager = (M) MAP.get(name);
             if (manager == null) {
                 manager = factory.createManager(name, data);

Modified: logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/AbstractOutputStreamAppender.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/AbstractOutputStreamAppender.java?rev=1476703&r1=1476702&r2=1476703&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/AbstractOutputStreamAppender.java (original)
+++ logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/AbstractOutputStreamAppender.java Sun Apr 28 01:27:27 2013
@@ -20,6 +20,7 @@ import org.apache.logging.log4j.core.Fil
 import org.apache.logging.log4j.core.Layout;
 import org.apache.logging.log4j.core.LogEvent;
 
+import java.io.Serializable;
 import java.util.concurrent.locks.Lock;
 import java.util.concurrent.locks.ReadWriteLock;
 import java.util.concurrent.locks.ReentrantReadWriteLock;
@@ -27,7 +28,7 @@ import java.util.concurrent.locks.Reentr
 /**
  * Appends log events as bytes to a byte output stream. The stream encoding is defined in the layout.
  */
-public abstract class AbstractOutputStreamAppender extends AbstractAppender {
+public abstract class AbstractOutputStreamAppender<T extends Serializable> extends AbstractAppender<T> {
 
     /**
      * Immediate flush means that the underlying writer or output stream
@@ -54,7 +55,7 @@ public abstract class AbstractOutputStre
      * @param layout The layout to format the message.
      * @param manager The OutputStreamManager.
      */
-    protected AbstractOutputStreamAppender(final String name, final Layout layout, final Filter filter,
+    protected AbstractOutputStreamAppender(final String name, final Layout<T> layout, final Filter filter,
                                            final boolean handleException, final boolean immediateFlush,
                                            final OutputStreamManager manager) {
         super(name, filter, layout, handleException);
@@ -107,6 +108,7 @@ public abstract class AbstractOutputStre
      * override this method.
      * @param event The LogEvent.
      */
+    @Override
     public void append(final LogEvent event) {
         readLock.lock();
         try {

Modified: logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/AsynchAppender.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/AsynchAppender.java?rev=1476703&r1=1476702&r2=1476703&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/AsynchAppender.java (original)
+++ logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/AsynchAppender.java Sun Apr 28 01:27:27 2013
@@ -57,7 +57,7 @@ public final class AsynchAppender<T exte
     private final AppenderRef[] appenderRefs;
     private final String errorRef;
     private final boolean includeLocation;
-    private AppenderControl errorAppender;
+    private AppenderControl<?> errorAppender;
     private AsynchThread thread;
 
     private AsynchAppender(final String name, final Filter filter, final AppenderRef[] appenderRefs,
@@ -74,9 +74,10 @@ public final class AsynchAppender<T exte
     }
 
     @Override
+    @SuppressWarnings("unchecked")
     public void start() {
         final Map<String, Appender<?>> map = config.getAppenders();
-        final List<AppenderControl> appenders = new ArrayList<AppenderControl>();
+        final List<AppenderControl<?>> appenders = new ArrayList<AppenderControl<?>>();
         for (final AppenderRef appenderRef : appenderRefs) {
             if (map.containsKey(appenderRef.getRef())) {
                 appenders.add(new AppenderControl(map.get(appenderRef.getRef()), appenderRef.getLevel(),
@@ -118,6 +119,7 @@ public final class AsynchAppender<T exte
      * <p/>
      * @param event The LogEvent.
      */
+    @Override
     public void append(final LogEvent event) {
         if (!isStarted()) {
             throw new IllegalStateException("AsynchAppender " + getName() + " is not active");
@@ -180,8 +182,7 @@ public final class AsynchAppender<T exte
 
         final boolean isBlocking = blocking == null ? true : Boolean.valueOf(blocking);
         final int queueSize = size == null ? DEFAULT_QUEUE_SIZE : Integer.parseInt(size);
-        final boolean isIncludeLocation = includeLocation == null ? false :
-                Boolean.parseBoolean(includeLocation);
+        final boolean isIncludeLocation = includeLocation != null && Boolean.parseBoolean(includeLocation);
 
         final boolean handleExceptions = suppress == null ? true : Boolean.valueOf(suppress);
 
@@ -195,10 +196,10 @@ public final class AsynchAppender<T exte
     private class AsynchThread extends Thread {
 
         private volatile boolean shutdown = false;
-        private final List<AppenderControl> appenders;
+        private final List<AppenderControl<?>> appenders;
         private final BlockingQueue<Serializable> queue;
 
-        public AsynchThread(final List<AppenderControl> appenders, final BlockingQueue<Serializable> queue) {
+        public AsynchThread(final List<AppenderControl<?>> appenders, final BlockingQueue<Serializable> queue) {
             this.appenders = appenders;
             this.queue = queue;
         }

Modified: logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/ConsoleAppender.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/ConsoleAppender.java?rev=1476703&r1=1476702&r2=1476703&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/ConsoleAppender.java (original)
+++ logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/ConsoleAppender.java Sun Apr 28 01:27:27 2013
@@ -29,6 +29,7 @@ import org.apache.logging.log4j.util.Pro
 import java.io.IOException;
 import java.io.OutputStream;
 import java.io.PrintStream;
+import java.io.Serializable;
 import java.lang.reflect.Constructor;
 
 /**
@@ -42,7 +43,7 @@ import java.lang.reflect.Constructor;
  * default. OTOH, a Writer cannot print byte streams.
  */
 @Plugin(name = "Console", type = "Core", elementType = "appender", printObject = true)
-public final class ConsoleAppender extends AbstractOutputStreamAppender {
+public final class ConsoleAppender<T extends Serializable> extends AbstractOutputStreamAppender<T> {
 
     private static ConsoleManagerFactory factory = new ConsoleManagerFactory();
 
@@ -56,7 +57,7 @@ public final class ConsoleAppender exten
         SYSTEM_ERR
     }
 
-    private ConsoleAppender(final String name, final Layout layout, final Filter filter,
+    private ConsoleAppender(final String name, final Layout<T> layout, final Filter filter,
                             final OutputStreamManager manager,
                             final boolean handleExceptions) {
         super(name, layout, filter, handleExceptions, true, manager);
@@ -74,7 +75,7 @@ public final class ConsoleAppender exten
      * @return The ConsoleAppender.
      */
     @PluginFactory
-    public static ConsoleAppender createAppender(@PluginElement("layout") Layout layout,
+    public static <S extends Serializable> ConsoleAppender<S> createAppender(@PluginElement("layout") Layout<S> layout,
                                                  @PluginElement("filters") final Filter filter,
                                                  @PluginAttr("target") final String t,
                                                  @PluginAttr("name") final String name,
@@ -85,12 +86,14 @@ public final class ConsoleAppender exten
             return null;
         }
         if (layout == null) {
-            layout = PatternLayout.createLayout(null, null, null, null);
+            @SuppressWarnings({"unchecked", "UnnecessaryLocalVariable"})
+            Layout<S> l = (Layout<S>)PatternLayout.createLayout(null, null, null, null);
+            layout = l;
         }
         final boolean isFollow = follow == null ? false : Boolean.valueOf(follow);
         final boolean handleExceptions = suppress == null ? true : Boolean.valueOf(suppress);
         final Target target = t == null ? Target.SYSTEM_OUT : Target.valueOf(t);
-        return new ConsoleAppender(name, layout, filter, getManager(isFollow, target), handleExceptions);
+        return new ConsoleAppender<S>(name, layout, filter, getManager(isFollow, target), handleExceptions);
     }
 
     private static OutputStreamManager getManager(final boolean follow, final Target target) {
@@ -224,6 +227,7 @@ public final class ConsoleAppender exten
          * @param data The data required to create the entity.
          * @return The OutputStreamManager
          */
+        @Override
         public OutputStreamManager createManager(final String name, final FactoryData data) {
             return new OutputStreamManager(data.os, data.type);
         }

Modified: logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/FailoverAppender.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/FailoverAppender.java?rev=1476703&r1=1476702&r2=1476703&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/FailoverAppender.java (original)
+++ logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/FailoverAppender.java Sun Apr 28 01:27:27 2013
@@ -29,6 +29,7 @@ import org.apache.logging.log4j.core.con
 import org.apache.logging.log4j.core.config.plugins.PluginFactory;
 import org.apache.logging.log4j.core.helpers.Constants;
 
+import java.io.Serializable;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
@@ -39,7 +40,7 @@ import java.util.Map;
  * to not suppress exceptions for the FailoverAppender to work.
  */
 @Plugin(name = "Failover", type = "Core", elementType = "appender", printObject = true)
-public final class FailoverAppender extends AbstractAppender {
+public final class FailoverAppender<T extends Serializable> extends AbstractAppender<T> {
 
     private static final int DEFAULT_INTERVAL = 60 * Constants.MILLIS_IN_SECONDS;
 
@@ -49,9 +50,9 @@ public final class FailoverAppender exte
 
     private final Configuration config;
 
-    private AppenderControl primary;
+    private AppenderControl<?> primary;
 
-    private final List<AppenderControl> failoverAppenders = new ArrayList<AppenderControl>();
+    private final List<AppenderControl<?>> failoverAppenders = new ArrayList<AppenderControl<?>>();
 
     private final long interval;
 
@@ -70,6 +71,7 @@ public final class FailoverAppender exte
 
 
     @Override
+    @SuppressWarnings("unchecked")
     public void start() {
         final Map<String, Appender<?>> map = config.getAppenders();
         int errors = 0;
@@ -99,8 +101,8 @@ public final class FailoverAppender exte
      * Handle the Log event.
      * @param event The LogEvent.
      */
+    @Override
     public void append(final LogEvent event) {
-        final RuntimeException re = null;
         if (!isStarted()) {
             error("FailoverAppender " + getName() + " did not start successfully");
             return;
@@ -180,7 +182,7 @@ public final class FailoverAppender exte
      * @return The FailoverAppender that was created.
      */
     @PluginFactory
-    public static FailoverAppender createAppender(@PluginAttr("name") final String name,
+    public static <S extends Serializable> FailoverAppender<S> createAppender(@PluginAttr("name") final String name,
                                                   @PluginAttr("primary") final String primary,
                                                   @PluginElement("failovers") final String[] failovers,
                                                   @PluginAttr("retryInterval") final String interval,
@@ -220,6 +222,6 @@ public final class FailoverAppender exte
 
         final boolean handleExceptions = suppress == null ? true : Boolean.valueOf(suppress);
 
-        return new FailoverAppender(name, filter, primary, failovers, retryInterval, config, handleExceptions);
+        return new FailoverAppender<S>(name, filter, primary, failovers, retryInterval, config, handleExceptions);
     }
 }

Modified: logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/FastFileAppender.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/FastFileAppender.java?rev=1476703&r1=1476702&r2=1476703&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/FastFileAppender.java (original)
+++ logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/FastFileAppender.java Sun Apr 28 01:27:27 2013
@@ -16,9 +16,6 @@
  */
 package org.apache.logging.log4j.core.appender;
 
-import java.util.HashMap;
-import java.util.Map;
-
 import org.apache.logging.log4j.core.Filter;
 import org.apache.logging.log4j.core.Layout;
 import org.apache.logging.log4j.core.LogEvent;
@@ -31,17 +28,21 @@ import org.apache.logging.log4j.core.con
 import org.apache.logging.log4j.core.layout.PatternLayout;
 import org.apache.logging.log4j.core.net.Advertiser;
 
+import java.io.Serializable;
+import java.util.HashMap;
+import java.util.Map;
+
 /**
  * File Appender.
  */
 @Plugin(name = "FastFile", type = "Core", elementType = "appender", printObject = true)
-public final class FastFileAppender extends AbstractOutputStreamAppender {
+public final class FastFileAppender<T extends Serializable> extends AbstractOutputStreamAppender<T> {
 
     private final String fileName;
     private Object advertisement;
     private final Advertiser advertiser;
 
-    private FastFileAppender(String name, Layout<?> layout, Filter filter,
+    private FastFileAppender(String name, Layout<T> layout, Filter filter,
             FastFileManager manager, String filename, boolean handleException,
             boolean immediateFlush, Advertiser advertiser) {
         super(name, layout, filter, handleException, immediateFlush, manager);
@@ -116,13 +117,13 @@ public final class FastFileAppender exte
      * @return The FileAppender.
      */
     @PluginFactory
-    public static FastFileAppender createAppender(
+    public static <S extends Serializable> FastFileAppender<S> createAppender(
             @PluginAttr("fileName") String fileName,
             @PluginAttr("append") String append,
             @PluginAttr("name") String name,
             @PluginAttr("immediateFlush") String immediateFlush,
             @PluginAttr("suppressExceptions") String suppress,
-            @PluginElement("layout") Layout<?> layout,
+            @PluginElement("layout") Layout<S> layout,
             @PluginElement("filters") final Filter filter,
             @PluginAttr("advertise") final String advertise,
             @PluginAttr("advertiseURI") final String advertiseURI,
@@ -153,9 +154,11 @@ public final class FastFileAppender exte
             return null;
         }
         if (layout == null) {
-            layout = PatternLayout.createLayout(null, null, null, null);
+            @SuppressWarnings({"unchecked", "UnnecessaryLocalVariable"})
+            Layout<S> l = (Layout<S>)PatternLayout.createLayout(null, null, null, null);
+            layout = l;
         }
-        return new FastFileAppender(name, layout, filter, manager, fileName,
+        return new FastFileAppender<S>(name, layout, filter, manager, fileName,
                 handleExceptions, isFlush, isAdvertise ? config.getAdvertiser()
                         : null);
     }

Modified: logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/FastRollingFileAppender.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/FastRollingFileAppender.java?rev=1476703&r1=1476702&r2=1476703&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/FastRollingFileAppender.java (original)
+++ logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/FastRollingFileAppender.java Sun Apr 28 01:27:27 2013
@@ -16,9 +16,6 @@
  */
 package org.apache.logging.log4j.core.appender;
 
-import java.util.HashMap;
-import java.util.Map;
-
 import org.apache.logging.log4j.core.Filter;
 import org.apache.logging.log4j.core.Layout;
 import org.apache.logging.log4j.core.LogEvent;
@@ -36,19 +33,23 @@ import org.apache.logging.log4j.core.con
 import org.apache.logging.log4j.core.layout.PatternLayout;
 import org.apache.logging.log4j.core.net.Advertiser;
 
+import java.io.Serializable;
+import java.util.HashMap;
+import java.util.Map;
+
 /**
  * An appender that writes to random access files and can roll over at
  * intervals.
  */
 @Plugin(name = "FastRollingFile", type = "Core", elementType = "appender", printObject = true)
-public final class FastRollingFileAppender extends AbstractOutputStreamAppender {
+public final class FastRollingFileAppender<T extends Serializable> extends AbstractOutputStreamAppender<T> {
 
     private final String fileName;
     private final String filePattern;
     private Object advertisement;
     private final Advertiser advertiser;
 
-    private FastRollingFileAppender(String name, Layout<?> layout,
+    private FastRollingFileAppender(String name, Layout<T> layout,
             Filter filter, RollingFileManager manager, String fileName,
             String filePattern, boolean handleException,
             boolean immediateFlush, Advertiser advertiser) {
@@ -138,7 +139,7 @@ public final class FastRollingFileAppend
      * @return A FastRollingFileAppender.
      */
     @PluginFactory
-    public static FastRollingFileAppender createAppender(
+    public static <S extends Serializable> FastRollingFileAppender<S> createAppender(
             @PluginAttr("fileName") final String fileName,
             @PluginAttr("filePattern") final String filePattern,
             @PluginAttr("append") final String append,
@@ -146,7 +147,7 @@ public final class FastRollingFileAppend
             @PluginAttr("immediateFlush") final String immediateFlush,
             @PluginElement("policy") final TriggeringPolicy policy,
             @PluginElement("strategy") RolloverStrategy strategy,
-            @PluginElement("layout") Layout<?> layout,
+            @PluginElement("layout") Layout<S> layout,
             @PluginElement("filter") final Filter filter,
             @PluginAttr("suppressExceptions") final String suppress,
             @PluginAttr("advertise") final String advertise,
@@ -197,10 +198,12 @@ public final class FastRollingFileAppend
         }
 
         if (layout == null) {
-            layout = PatternLayout.createLayout(null, null, null, null);
+            @SuppressWarnings({"unchecked", "UnnecessaryLocalVariable"})
+            Layout<S> l = (Layout<S>)PatternLayout.createLayout(null, null, null, null);
+            layout = l;
         }
 
-        return new FastRollingFileAppender(name, layout, filter, manager,
+        return new FastRollingFileAppender<S>(name, layout, filter, manager,
                 fileName, filePattern, handleExceptions, isFlush,
                 isAdvertise ? config.getAdvertiser() : null);
     }

Modified: logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/FileAppender.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/FileAppender.java?rev=1476703&r1=1476702&r2=1476703&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/FileAppender.java (original)
+++ logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/FileAppender.java Sun Apr 28 01:27:27 2013
@@ -16,8 +16,6 @@
  */
 package org.apache.logging.log4j.core.appender;
 
-import java.util.HashMap;
-import java.util.Map;
 import org.apache.logging.log4j.core.Filter;
 import org.apache.logging.log4j.core.Layout;
 import org.apache.logging.log4j.core.config.Configuration;
@@ -29,18 +27,23 @@ import org.apache.logging.log4j.core.con
 import org.apache.logging.log4j.core.layout.PatternLayout;
 import org.apache.logging.log4j.core.net.Advertiser;
 
+import java.io.Serializable;
+import java.util.HashMap;
+import java.util.Map;
+
 /**
  * File Appender.
  */
 @Plugin(name = "File", type = "Core", elementType = "appender", printObject = true)
-public final class FileAppender extends AbstractOutputStreamAppender {
+public final class FileAppender<T extends Serializable> extends AbstractOutputStreamAppender<T> {
 
     private final String fileName;
     private final Advertiser advertiser;
     private Object advertisement;
 
-    private FileAppender(final String name, final Layout layout, final Filter filter, final FileManager manager,
-                         final String filename, final boolean handleException, final boolean immediateFlush, Advertiser advertiser) {
+    private FileAppender(final String name, final Layout<T> layout, final Filter filter, final FileManager manager,
+                         final String filename, final boolean handleException, final boolean immediateFlush,
+                         Advertiser advertiser) {
         super(name, layout, filter, handleException, immediateFlush, manager);
         if (advertiser != null)
         {
@@ -91,14 +94,14 @@ public final class FileAppender extends 
      * @return The FileAppender.
      */
     @PluginFactory
-    public static FileAppender createAppender(@PluginAttr("fileName") final String fileName,
+    public static <S extends Serializable> FileAppender<S> createAppender(@PluginAttr("fileName") final String fileName,
                                               @PluginAttr("append") final String append,
                                               @PluginAttr("locking") final String locking,
                                               @PluginAttr("name") final String name,
                                               @PluginAttr("immediateFlush") final String immediateFlush,
                                               @PluginAttr("suppressExceptions") final String suppress,
                                               @PluginAttr("bufferedIO") final String bufferedIO,
-                                              @PluginElement("layout") Layout layout,
+                                              @PluginElement("layout") Layout<S> layout,
                                               @PluginElement("filters") final Filter filter,
                                               @PluginAttr("advertise") final String advertise,
                                               @PluginAttr("advertiseURI") final String advertiseURI,
@@ -132,9 +135,12 @@ public final class FileAppender extends 
             return null;
         }
         if (layout == null) {
-            layout = PatternLayout.createLayout(null, null, null, null);
+            @SuppressWarnings({"unchecked", "UnnecessaryLocalVariable"})
+            Layout<S> l = (Layout<S>)PatternLayout.createLayout(null, null, null, null);
+            layout = l;
         }
 
-        return new FileAppender(name, layout, filter, manager, fileName, handleExceptions, isFlush, isAdvertise ? config.getAdvertiser() : null);
+        return new FileAppender<S>(name, layout, filter, manager, fileName, handleExceptions, isFlush,
+                isAdvertise ? config.getAdvertiser() : null);
     }
 }

Modified: logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/JMSQueueAppender.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/JMSQueueAppender.java?rev=1476703&r1=1476702&r2=1476703&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/JMSQueueAppender.java (original)
+++ logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/JMSQueueAppender.java Sun Apr 28 01:27:27 2013
@@ -26,16 +26,18 @@ import org.apache.logging.log4j.core.con
 import org.apache.logging.log4j.core.layout.SerializedLayout;
 import org.apache.logging.log4j.core.net.JMSQueueManager;
 
+import java.io.Serializable;
+
 /**
  * Appender to write to a JMS Queue.
  */
 @Plugin(name = "JMSQueue", type = "Core", elementType = "appender", printObject = true)
-public final class JMSQueueAppender extends AbstractAppender {
+public final class JMSQueueAppender<T extends Serializable> extends AbstractAppender<T> {
 
     private final JMSQueueManager manager;
 
-    private JMSQueueAppender(final String name, final Filter filter, final Layout layout, final JMSQueueManager manager,
-                            final boolean handleExceptions) {
+    private JMSQueueAppender(final String name, final Filter filter, final Layout<T> layout,
+                             final JMSQueueManager manager, final boolean handleExceptions) {
         super(name, filter, layout, handleExceptions);
         this.manager = manager;
     }
@@ -45,6 +47,7 @@ public final class JMSQueueAppender exte
      * <p/>
      * @param event The LogEvent.
      */
+    @Override
     public void append(final LogEvent event) {
         try {
             manager.send(getLayout().toSerializable(event));
@@ -73,7 +76,7 @@ public final class JMSQueueAppender exte
      * @return The JMSQueueAppender.
      */
     @PluginFactory
-    public static JMSQueueAppender createAppender(
+    public static <S extends Serializable> JMSQueueAppender<S> createAppender(
                                                 @PluginAttr("name") final String name,
                                                 @PluginAttr("factoryName") final String factoryName,
                                                 @PluginAttr("providerURL") final String providerURL,
@@ -84,7 +87,7 @@ public final class JMSQueueAppender exte
                                                 @PluginAttr("queueBindingName") final String queueBindingName,
                                                 @PluginAttr("userName") final String userName,
                                                 @PluginAttr("password") final String password,
-                                                @PluginElement("layout") Layout layout,
+                                                @PluginElement("layout") Layout<S> layout,
                                                 @PluginElement("filter") final Filter filter,
                                                 @PluginAttr("suppressExceptions") final String suppress) {
         if (name == null) {
@@ -98,8 +101,10 @@ public final class JMSQueueAppender exte
             return null;
         }
         if (layout == null) {
-            layout = SerializedLayout.createLayout();
+            @SuppressWarnings({"unchecked", "UnnecessaryLocalVariable"})
+            Layout<S> l = (Layout<S>) SerializedLayout.createLayout();
+            layout = l;
         }
-        return new JMSQueueAppender(name, filter, layout, manager, handleExceptions);
+        return new JMSQueueAppender<S>(name, filter, layout, manager, handleExceptions);
     }
 }

Modified: logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/JMSTopicAppender.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/JMSTopicAppender.java?rev=1476703&r1=1476702&r2=1476703&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/JMSTopicAppender.java (original)
+++ logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/JMSTopicAppender.java Sun Apr 28 01:27:27 2013
@@ -26,16 +26,18 @@ import org.apache.logging.log4j.core.con
 import org.apache.logging.log4j.core.layout.SerializedLayout;
 import org.apache.logging.log4j.core.net.JMSTopicManager;
 
+import java.io.Serializable;
+
 /**
  * Appender to write to a JMS Topic.
  */
 @Plugin(name = "JMSTopic", type = "Core", elementType = "appender", printObject = true)
-public final class JMSTopicAppender extends AbstractAppender {
+public final class JMSTopicAppender<T extends Serializable> extends AbstractAppender<T> {
 
     private final JMSTopicManager manager;
 
-    private JMSTopicAppender(final String name, final Filter filter, final Layout layout, final JMSTopicManager manager,
-                            final boolean handleExceptions) {
+    private JMSTopicAppender(final String name, final Filter filter, final Layout<T> layout,
+                             final JMSTopicManager manager, final boolean handleExceptions) {
         super(name, filter, layout, handleExceptions);
         this.manager = manager;
     }
@@ -45,6 +47,7 @@ public final class JMSTopicAppender exte
      * <p/>
      * @param event The LogEvent.
      */
+    @Override
     public void append(final LogEvent event) {
         try {
             manager.send(getLayout().toSerializable(event));
@@ -73,7 +76,7 @@ public final class JMSTopicAppender exte
      * @return The JMSTopicAppender.
      */
     @PluginFactory
-    public static JMSTopicAppender createAppender(
+    public static <S extends Serializable> JMSTopicAppender<S> createAppender(
                                                 @PluginAttr("name") final String name,
                                                 @PluginAttr("factoryName") final String factoryName,
                                                 @PluginAttr("providerURL") final String providerURL,
@@ -84,7 +87,7 @@ public final class JMSTopicAppender exte
                                                 @PluginAttr("topicBindingName") final String topicBindingName,
                                                 @PluginAttr("userName") final String userName,
                                                 @PluginAttr("password") final String password,
-                                                @PluginElement("layout") Layout layout,
+                                                @PluginElement("layout") Layout<S> layout,
                                                 @PluginElement("filters") final Filter filter,
                                                 @PluginAttr("suppressExceptions") final String suppress) {
 
@@ -99,8 +102,10 @@ public final class JMSTopicAppender exte
             return null;
         }
         if (layout == null) {
-            layout = SerializedLayout.createLayout();
+            @SuppressWarnings({"unchecked", "UnnecessaryLocalVariable"})
+            Layout<S> l = (Layout<S>)SerializedLayout.createLayout();
+            layout = l;
         }
-        return new JMSTopicAppender(name, filter, layout, manager, handleExceptions);
+        return new JMSTopicAppender<S>(name, filter, layout, manager, handleExceptions);
     }
 }

Modified: logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/RollingFileAppender.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/RollingFileAppender.java?rev=1476703&r1=1476702&r2=1476703&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/RollingFileAppender.java (original)
+++ logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/RollingFileAppender.java Sun Apr 28 01:27:27 2013
@@ -16,8 +16,6 @@
  */
 package org.apache.logging.log4j.core.appender;
 
-import java.util.HashMap;
-import java.util.Map;
 import org.apache.logging.log4j.core.Filter;
 import org.apache.logging.log4j.core.Layout;
 import org.apache.logging.log4j.core.LogEvent;
@@ -34,11 +32,15 @@ import org.apache.logging.log4j.core.con
 import org.apache.logging.log4j.core.layout.PatternLayout;
 import org.apache.logging.log4j.core.net.Advertiser;
 
+import java.io.Serializable;
+import java.util.HashMap;
+import java.util.Map;
+
 /**
  * An appender that writes to files and can roll over at intervals.
  */
 @Plugin(name = "RollingFile", type = "Core", elementType = "appender", printObject = true)
-public final class RollingFileAppender extends AbstractOutputStreamAppender {
+public final class RollingFileAppender<T extends Serializable> extends AbstractOutputStreamAppender<T> {
 
     private final String fileName;
     private final String filePattern;
@@ -46,7 +48,7 @@ public final class RollingFileAppender e
     private final Advertiser advertiser;
 
 
-    private RollingFileAppender(final String name, final Layout layout, final Filter filter,
+    private RollingFileAppender(final String name, final Layout<T> layout, final Filter filter,
                                 final RollingFileManager manager, final String fileName,
                                 final String filePattern, final boolean handleException, final boolean immediateFlush,
                                 Advertiser advertiser) {
@@ -119,7 +121,8 @@ public final class RollingFileAppender e
      * @return A RollingFileAppender.
      */
     @PluginFactory
-    public static RollingFileAppender createAppender(@PluginAttr("fileName") final String fileName,
+    public static <S extends Serializable> RollingFileAppender<S> createAppender(
+                                              @PluginAttr("fileName") final String fileName,
                                               @PluginAttr("filePattern") final String filePattern,
                                               @PluginAttr("append") final String append,
                                               @PluginAttr("name") final String name,
@@ -127,7 +130,7 @@ public final class RollingFileAppender e
                                               @PluginAttr("immediateFlush") final String immediateFlush,
                                               @PluginElement("policy") final TriggeringPolicy policy,
                                               @PluginElement("strategy") RolloverStrategy strategy,
-                                              @PluginElement("layout") Layout layout,
+                                              @PluginElement("layout") Layout<S> layout,
                                               @PluginElement("filter") final Filter filter,
                                               @PluginAttr("suppressExceptions") final String suppress,
                                               @PluginAttr("advertise") final String advertise,
@@ -170,10 +173,12 @@ public final class RollingFileAppender e
         }
 
         if (layout == null) {
-            layout = PatternLayout.createLayout(null, null, null, null);
+            @SuppressWarnings({"unchecked", "UnnecessaryLocalVariable"})
+            Layout<S> l = (Layout<S>)PatternLayout.createLayout(null, null, null, null);
+            layout = l;
         }
 
-        return new RollingFileAppender(name, layout, filter, manager, fileName, filePattern,
+        return new RollingFileAppender<S>(name, layout, filter, manager, fileName, filePattern,
             handleExceptions, isFlush, isAdvertise ? config.getAdvertiser() : null);
     }
 }

Modified: logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/SMTPAppender.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/SMTPAppender.java?rev=1476703&r1=1476702&r2=1476703&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/SMTPAppender.java (original)
+++ logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/SMTPAppender.java Sun Apr 28 01:27:27 2013
@@ -28,6 +28,8 @@ import org.apache.logging.log4j.core.Fil
 import org.apache.logging.log4j.core.Layout;
 import org.apache.logging.log4j.core.LogEvent;
 
+import java.io.Serializable;
+
 /**
  * Send an e-mail when a specific logging event occurs, typically on errors or
  * fatal errors.
@@ -47,14 +49,14 @@ import org.apache.logging.log4j.core.Log
  * appender.
  */
 @Plugin(name = "SMTP", type = "Core", elementType = "appender", printObject = true)
-public final class SMTPAppender extends AbstractAppender {
+public final class SMTPAppender<T extends Serializable> extends AbstractAppender<T> {
 
     private static final int DEFAULT_BUFFER_SIZE = 512;
 
     /** The SMTP Manager */
     protected final SMTPManager manager;
 
-    private SMTPAppender(final String name, final Filter filter, final Layout<?> layout, final SMTPManager manager,
+    private SMTPAppender(final String name, final Filter filter, final Layout<T> layout, final SMTPManager manager,
                          final boolean handleExceptions) {
         super(name, filter, layout, handleExceptions);
         this.manager = manager;
@@ -101,7 +103,7 @@ public final class SMTPAppender extends 
      * @return The SMTPAppender.
      */
     @PluginFactory
-    public static SMTPAppender createAppender(@PluginAttr("name") final String name,
+    public static <S extends Serializable> SMTPAppender<S> createAppender(@PluginAttr("name") final String name,
                                               @PluginAttr("to") final String to,
                                               @PluginAttr("cc") final String cc,
                                               @PluginAttr("bcc") final String bcc,
@@ -115,7 +117,7 @@ public final class SMTPAppender extends 
                                               @PluginAttr("smtpPassword") final String smtpPassword,
                                               @PluginAttr("smtpDebug") final String smtpDebug,
                                               @PluginAttr("bufferSize") final String bufferSizeNum,
-                                              @PluginElement("layout") Layout<?> layout,
+                                              @PluginElement("layout") Layout<S> layout,
                                               @PluginElement("filter") Filter filter,
                                               @PluginAttr("suppressExceptions") final String suppressExceptions) {
         if (name == null) {
@@ -129,7 +131,9 @@ public final class SMTPAppender extends 
         final int bufferSize = bufferSizeNum == null ? DEFAULT_BUFFER_SIZE : Integer.valueOf(bufferSizeNum);
 
         if (layout == null) {
-            layout = HTMLLayout.createLayout(null, null, null, null, null, null);
+            @SuppressWarnings({"unchecked", "UnnecessaryLocalVariable"})
+            Layout<S> l = (Layout<S>)HTMLLayout.createLayout(null, null, null, null, null, null);
+            layout = l;
         }
         if (filter == null) {
             filter = ThresholdFilter.createFilter(null, null, null);
@@ -141,7 +145,7 @@ public final class SMTPAppender extends 
             return null;
         }
 
-        return new SMTPAppender(name, filter, layout, manager, isHandleExceptions);
+        return new SMTPAppender<S>(name, filter, layout, manager, isHandleExceptions);
     }
 
     /**
@@ -164,6 +168,7 @@ public final class SMTPAppender extends 
      * sent.
      * @param event The Log event.
      */
+    @Override
     public void append(final LogEvent event) {
         manager.sendEvents(getLayout(), event);
     }

Modified: logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/SocketAppender.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/SocketAppender.java?rev=1476703&r1=1476702&r2=1476703&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/SocketAppender.java (original)
+++ logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/SocketAppender.java Sun Apr 28 01:27:27 2013
@@ -16,8 +16,6 @@
  */
 package org.apache.logging.log4j.core.appender;
 
-import java.util.HashMap;
-import java.util.Map;
 import org.apache.logging.log4j.core.Filter;
 import org.apache.logging.log4j.core.Layout;
 import org.apache.logging.log4j.core.config.Configuration;
@@ -34,15 +32,19 @@ import org.apache.logging.log4j.core.net
 import org.apache.logging.log4j.core.net.TCPSocketManager;
 import org.apache.logging.log4j.util.EnglishEnums;
 
+import java.io.Serializable;
+import java.util.HashMap;
+import java.util.Map;
+
 /**
  * An Appender that delivers events over socket connections. Supports both TCP and UDP.
  */
 @Plugin(name = "Socket", type = "Core", elementType = "appender", printObject = true)
-public class SocketAppender extends AbstractOutputStreamAppender {
+public class SocketAppender<T extends Serializable> extends AbstractOutputStreamAppender<T> {
     private Object advertisement;
     private final Advertiser advertiser;
 
-    protected SocketAppender(final String name, final Layout layout, final Filter filter,
+    protected SocketAppender(final String name, final Layout<T> layout, final Filter filter,
                              final AbstractSocketManager manager, final boolean handleException,
                              final boolean immediateFlush, Advertiser advertiser) {
         super(name, layout, filter, handleException, immediateFlush, manager);
@@ -83,7 +85,7 @@ public class SocketAppender extends Abst
      * @return A SocketAppender.
      */
     @PluginFactory
-    public static SocketAppender createAppender(@PluginAttr("host") final String host,
+    public static <S extends Serializable> SocketAppender<S> createAppender(@PluginAttr("host") final String host,
                                                 @PluginAttr("port") final String portNum,
                                                 @PluginAttr("protocol") final String protocol,
                                                 @PluginAttr("reconnectionDelay") final String delay,
@@ -91,7 +93,7 @@ public class SocketAppender extends Abst
                                                 @PluginAttr("name") final String name,
                                                 @PluginAttr("immediateFlush") final String immediateFlush,
                                                 @PluginAttr("suppressExceptions") final String suppress,
-                                                @PluginElement("layout") Layout layout,
+                                                @PluginElement("layout") Layout<S> layout,
                                                 @PluginElement("filters") final Filter filter,
                                                 @PluginAttr("advertise") final String advertise,
                                                 @PluginConfiguration final Configuration config) {
@@ -103,7 +105,9 @@ public class SocketAppender extends Abst
         final int reconnectDelay = delay == null ? 0 : Integer.parseInt(delay);
         final int port = portNum == null ? 0 : Integer.parseInt(portNum);
         if (layout == null) {
-            layout = SerializedLayout.createLayout();
+            @SuppressWarnings({"unchecked", "UnnecessaryLocalVariable"})
+            Layout<S> l = (Layout<S>) SerializedLayout.createLayout();
+            layout = l;
         }
 
         if (name == null) {
@@ -118,7 +122,8 @@ public class SocketAppender extends Abst
             return null;
         }
 
-        return new SocketAppender(name, layout, filter, manager, handleExceptions, isFlush, isAdvertise ? config.getAdvertiser() : null);
+        return new SocketAppender<S>(name, layout, filter, manager, handleExceptions, isFlush,
+                isAdvertise ? config.getAdvertiser() : null);
     }
 
     protected static AbstractSocketManager createSocketManager(final String protocol, final String host, final int port,

Modified: logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/SyslogAppender.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/SyslogAppender.java?rev=1476703&r1=1476702&r2=1476703&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/SyslogAppender.java (original)
+++ logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/SyslogAppender.java Sun Apr 28 01:27:27 2013
@@ -30,18 +30,21 @@ import org.apache.logging.log4j.core.net
 import org.apache.logging.log4j.core.net.Advertiser;
 import org.apache.logging.log4j.core.net.Protocol;
 
+import java.io.Serializable;
+
 /**
  * The Syslog Appender.
  */
 @Plugin(name = "Syslog", type = "Core", elementType = "appender", printObject = true)
-public class SyslogAppender extends SocketAppender {
+public class SyslogAppender<T extends Serializable> extends SocketAppender<T> {
 
     private static final String BSD = "bsd";
 
     private static final String RFC5424 = "RFC5424";
 
-    protected SyslogAppender(final String name, final Layout layout, final Filter filter, final boolean handleException,
-                             final boolean immediateFlush, final AbstractSocketManager manager, Advertiser advertiser) {
+    protected SyslogAppender(final String name, final Layout<T> layout, final Filter filter,
+                             final boolean handleException, final boolean immediateFlush,
+                             final AbstractSocketManager manager, Advertiser advertiser) {
         super(name, layout, filter, manager, handleException, immediateFlush, advertiser);
 
     }
@@ -81,7 +84,7 @@ public class SyslogAppender extends Sock
      * @return A SyslogAppender.
      */
     @PluginFactory
-    public static SyslogAppender createAppender(@PluginAttr("host") final String host,
+    public static <S extends Serializable> SyslogAppender<S> createAppender(@PluginAttr("host") final String host,
                                                 @PluginAttr("port") final String portNum,
                                                 @PluginAttr("protocol") final String protocol,
                                                 @PluginAttr("reconnectionDelay") final String delay,
@@ -116,10 +119,11 @@ public class SyslogAppender extends Sock
         final boolean fail = immediateFail == null ? true : Boolean.valueOf(immediateFail);
         final int port = portNum == null ? 0 : Integer.parseInt(portNum);
         boolean isAdvertise = advertise == null ? false : Boolean.valueOf(advertise);
-        final Layout<String> layout = RFC5424.equalsIgnoreCase(format) ?
+        @SuppressWarnings("unchecked")
+        final Layout<S> layout = (Layout<S>)(RFC5424.equalsIgnoreCase(format) ?
             RFC5424Layout.createLayout(facility, id, ein, includeMDC, mdcId, mdcPrefix, eventPrefix, includeNL,
                 escapeNL, appName, msgId, excludes, includes, required, charsetName, exceptionPattern, config) :
-            SyslogLayout.createLayout(facility, includeNL, escapeNL, charsetName);
+            SyslogLayout.createLayout(facility, includeNL, escapeNL, charsetName));
 
         if (name == null) {
             LOGGER.error("No name provided for SyslogAppender");
@@ -131,6 +135,7 @@ public class SyslogAppender extends Sock
             return null;
         }
 
-        return new SyslogAppender(name, layout, filter, handleExceptions, isFlush, manager, isAdvertise ? config.getAdvertiser() : null);
+        return new SyslogAppender<S>(name, layout, filter, handleExceptions, isFlush, manager,
+                isAdvertise ? config.getAdvertiser() : null);
     }
 }

Modified: logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/rewrite/RewriteAppender.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/rewrite/RewriteAppender.java?rev=1476703&r1=1476702&r2=1476703&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/rewrite/RewriteAppender.java (original)
+++ logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/rewrite/RewriteAppender.java Sun Apr 28 01:27:27 2013
@@ -29,6 +29,7 @@ import org.apache.logging.log4j.core.con
 import org.apache.logging.log4j.core.config.plugins.PluginElement;
 import org.apache.logging.log4j.core.config.plugins.PluginFactory;
 
+import java.io.Serializable;
 import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentMap;
@@ -37,7 +38,7 @@ import java.util.concurrent.ConcurrentMa
  * This Appender allows the logging event to be manipulated before it is processed by other Appenders.
  */
 @Plugin(name = "Rewrite", type = "Core", elementType = "appender", printObject = true)
-public final class RewriteAppender extends AbstractAppender {
+public final class RewriteAppender<T extends Serializable> extends AbstractAppender<T> {
     private final Configuration config;
     private final ConcurrentMap<String, AppenderControl> appenders = new ConcurrentHashMap<String, AppenderControl>();
     private final RewritePolicy rewritePolicy;
@@ -53,6 +54,7 @@ public final class RewriteAppender exten
     }
 
     @Override
+    @SuppressWarnings("unchecked")
     public void start() {
         final Map<String, Appender<?>> map = config.getAppenders();
         for (final AppenderRef ref : appenderRefs) {
@@ -76,6 +78,7 @@ public final class RewriteAppender exten
      * Modify the event and pass to the subordinate Appenders.
      * @param event The LogEvent.
      */
+    @Override
     public void append(LogEvent event) {
         if (rewritePolicy != null) {
             event = rewritePolicy.rewrite(event);
@@ -96,7 +99,7 @@ public final class RewriteAppender exten
      * @return The created RewriteAppender.
      */
     @PluginFactory
-    public static RewriteAppender createAppender(@PluginAttr("name") final String name,
+    public static <S extends Serializable> RewriteAppender<S> createAppender(@PluginAttr("name") final String name,
                                           @PluginAttr("suppressExceptions") final String suppress,
                                           @PluginElement("appender-ref") final AppenderRef[] appenderRefs,
                                           @PluginConfiguration final Configuration config,
@@ -113,6 +116,6 @@ public final class RewriteAppender exten
             LOGGER.error("No appender references defined for RewriteAppender");
             return null;
         }
-        return new RewriteAppender(name, filter, handleExceptions, appenderRefs, rewritePolicy, config);
+        return new RewriteAppender<S>(name, filter, handleExceptions, appenderRefs, rewritePolicy, config);
     }
 }

Modified: logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/routing/RoutingAppender.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/routing/RoutingAppender.java?rev=1476703&r1=1476702&r2=1476703&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/routing/RoutingAppender.java (original)
+++ logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/appender/routing/RoutingAppender.java Sun Apr 28 01:27:27 2013
@@ -30,6 +30,7 @@ import org.apache.logging.log4j.core.con
 import org.apache.logging.log4j.core.config.plugins.PluginElement;
 import org.apache.logging.log4j.core.config.plugins.PluginFactory;
 
+import java.io.Serializable;
 import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentMap;
@@ -43,12 +44,13 @@ import java.util.concurrent.ConcurrentMa
  * the built in StrSubstitutor and the StrLookup plugin that matches the specified key.
  */
 @Plugin(name = "Routing", type = "Core", elementType = "appender", printObject = true)
-public final class RoutingAppender extends AbstractAppender {
+public final class RoutingAppender<T extends Serializable> extends AbstractAppender<T> {
     private static final String DEFAULT_KEY = "ROUTING_APPENDER_DEFAULT";
     private final Routes routes;
     private final Route defaultRoute;
     private final Configuration config;
-    private final ConcurrentMap<String, AppenderControl> appenders = new ConcurrentHashMap<String, AppenderControl>();
+    private final ConcurrentMap<String, AppenderControl<T>> appenders =
+            new ConcurrentHashMap<String, AppenderControl<T>>();
     private final RewritePolicy rewritePolicy;
 
     private RoutingAppender(final String name, final Filter filter, final boolean handleException, final Routes routes,
@@ -71,12 +73,13 @@ public final class RoutingAppender exten
     }
 
     @Override
+    @SuppressWarnings("unchecked")
     public void start() {
         final Map<String, Appender<?>> map = config.getAppenders();
         // Register all the static routes.
         for (final Route route : routes.getRoutes()) {
             if (route.getAppenderRef() != null) {
-                final Appender appender = map.get(route.getAppenderRef());
+                final Appender<?> appender = map.get(route.getAppenderRef());
                 if (appender != null) {
                     final String key = route == defaultRoute ? DEFAULT_KEY : route.getKey();
                     appenders.put(key, new AppenderControl(appender, null, null));
@@ -92,7 +95,7 @@ public final class RoutingAppender exten
     public void stop() {
         super.stop();
         final Map<String, Appender<?>> map = config.getAppenders();
-        for (final Map.Entry<String, AppenderControl> entry : appenders.entrySet()) {
+        for (final Map.Entry<String, AppenderControl<T>> entry : appenders.entrySet()) {
             final String name = entry.getValue().getAppender().getName();
             if (!map.containsKey(name)) {
                 entry.getValue().getAppender().stop();
@@ -100,19 +103,20 @@ public final class RoutingAppender exten
         }
     }
 
+    @Override
     public void append(LogEvent event) {
         if (rewritePolicy != null) {
             event = rewritePolicy.rewrite(event);
         }
         final String key = config.getSubst().replace(event, routes.getPattern());
-        final AppenderControl control = getControl(key, event);
+        final AppenderControl<T> control = getControl(key, event);
         if (control != null) {
             control.callAppender(event);
         }
     }
 
-    private synchronized AppenderControl getControl(final String key, final LogEvent event) {
-        AppenderControl control = appenders.get(key);
+    private synchronized AppenderControl<T> getControl(final String key, final LogEvent event) {
+        AppenderControl<T> control = appenders.get(key);
         if (control != null) {
             return control;
         }
@@ -127,25 +131,26 @@ public final class RoutingAppender exten
             route = defaultRoute;
         }
         if (route != null) {
-            final Appender app = createAppender(route, event);
+            final Appender<T> app = createAppender(route, event);
             if (app == null) {
                 return null;
             }
-            control = new AppenderControl(app, null, null);
+            control = new AppenderControl<T>(app, null, null);
             appenders.put(key, control);
         }
 
         return control;
     }
 
-    private Appender createAppender(final Route route, final LogEvent event) {
+    private Appender<T> createAppender(final Route route, final LogEvent event) {
         final Node routeNode = route.getNode();
         for (final Node node : routeNode.getChildren()) {
             if (node.getType().getElementName().equals("appender")) {
                 final Node appNode = new Node(node);
                 config.createConfiguration(appNode, event);
                 if (appNode.getObject() instanceof Appender) {
-                    final Appender app = (Appender) appNode.getObject();
+                    @SuppressWarnings("unchecked")
+                    final Appender<T> app = (Appender<T>) appNode.getObject();
                     app.start();
                     return app;
                 }
@@ -169,7 +174,7 @@ public final class RoutingAppender exten
      * @return The RoutingAppender
      */
     @PluginFactory
-    public static RoutingAppender createAppender(@PluginAttr("name") final String name,
+    public static <S extends Serializable> RoutingAppender<S> createAppender(@PluginAttr("name") final String name,
                                           @PluginAttr("suppressExceptions") final String suppress,
                                           @PluginElement("routes") final Routes routes,
                                           @PluginConfiguration final Configuration config,
@@ -186,6 +191,6 @@ public final class RoutingAppender exten
             LOGGER.error("No routes defined for RoutingAppender");
             return null;
         }
-        return new RoutingAppender(name, filter, handleExceptions, routes, rewritePolicy, config);
+        return new RoutingAppender<S>(name, filter, handleExceptions, routes, rewritePolicy, config);
     }
 }

Modified: logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/config/BaseConfiguration.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/config/BaseConfiguration.java?rev=1476703&r1=1476702&r2=1476703&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/config/BaseConfiguration.java (original)
+++ logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/config/BaseConfiguration.java Sun Apr 28 01:27:27 2013
@@ -42,6 +42,7 @@ import org.apache.logging.log4j.core.net
 import org.apache.logging.log4j.status.StatusLogger;
 import org.apache.logging.log4j.util.PropertiesUtil;
 
+import java.io.Serializable;
 import java.lang.annotation.Annotation;
 import java.lang.reflect.Array;
 import java.lang.reflect.Method;
@@ -107,6 +108,8 @@ public class BaseConfiguration extends A
         rootNode = new Node();
     }
 
+    @Override
+    @SuppressWarnings("unchecked")
     public Map<String, String> getProperties() {
         return (Map<String, String>) componentMap.get(CONTEXT_PROPERTIES);
     }
@@ -114,6 +117,7 @@ public class BaseConfiguration extends A
     /**
      * Initialize the configuration.
      */
+    @Override
     public void start() {
         setup();
         doConfigure();
@@ -130,6 +134,7 @@ public class BaseConfiguration extends A
     /**
      * Tear down the configuration.
      */
+    @Override
     public void stop() {
         for (final LoggerConfig logger : loggers.values()) {
             logger.clearAppenders();
@@ -146,14 +151,17 @@ public class BaseConfiguration extends A
     protected void setup() {
     }
 
+    @Override
     public Object getComponent(final String name) {
         return componentMap.get(name);
     }
 
+    @Override
     public void addComponent(final String name, final Object obj) {
         componentMap.putIfAbsent(name, obj);
     }
 
+    @SuppressWarnings("unchecked")
     protected void doConfigure() {
         boolean setRoot = false;
         boolean setLoggers = false;
@@ -220,9 +228,10 @@ public class BaseConfiguration extends A
 
     private void setToDefault() {
         setName(DefaultConfiguration.DEFAULT_NAME);
-        final Layout layout = PatternLayout.createLayout("%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n",
-            null, null, null);
-        final Appender appender = ConsoleAppender.createAppender(layout, null, "SYSTEM_OUT", "Console", "false",
+        final Layout<? extends Serializable> layout =
+                PatternLayout.createLayout("%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n",
+                        null, null, null);
+        final Appender<?> appender = ConsoleAppender.createAppender(layout, null, "SYSTEM_OUT", "Console", "false",
             "true");
         appender.start();
         addAppender(appender);
@@ -255,6 +264,7 @@ public class BaseConfiguration extends A
      * Returns the name of the configuration.
      * @return the name of the configuration.
      */
+    @Override
     public String getName() {
         return name;
     }
@@ -263,6 +273,7 @@ public class BaseConfiguration extends A
      * Add a listener for changes on the configuration.
      * @param listener The ConfigurationListener to add.
      */
+    @Override
     public void addListener(final ConfigurationListener listener) {
         listeners.add(listener);
     }
@@ -271,6 +282,7 @@ public class BaseConfiguration extends A
      * Remove a ConfigurationListener.
      * @param listener The ConfigurationListener to remove.
      */
+    @Override
     public void removeListener(final ConfigurationListener listener) {
         listeners.remove(listener);
     }
@@ -280,7 +292,7 @@ public class BaseConfiguration extends A
      * @param name The name of the Appender.
      * @return the Appender with the specified name or null if the Appender cannot be located.
      */
-    public Appender getAppender(final String name) {
+    public Appender<?> getAppender(final String name) {
         return appenders.get(name);
     }
 
@@ -288,6 +300,7 @@ public class BaseConfiguration extends A
      * Returns a Map containing all the Appenders and their name.
      * @return A Map containing each Appender's name and the Appender object.
      */
+    @Override
     public Map<String, Appender<?>> getAppenders() {
         return appenders;
     }
@@ -300,22 +313,27 @@ public class BaseConfiguration extends A
         appenders.put(appender.getName(), appender);
     }
 
+    @Override
     public StrSubstitutor getSubst() {
         return subst;
     }
 
+    @Override
     public void setConfigurationMonitor(ConfigurationMonitor monitor) {
         this.monitor = monitor;
     }
 
+    @Override
     public ConfigurationMonitor getConfigurationMonitor() {
         return monitor;
     }
 
+    @Override
     public void setAdvertiser(Advertiser advertiser) {
         this.advertiser = advertiser;
     }
 
+    @Override
     public Advertiser getAdvertiser() {
         return advertiser;
     }
@@ -329,8 +347,9 @@ public class BaseConfiguration extends A
      * @param logger The Logger the Appender will be associated with.
      * @param appender The Appender.
      */
+    @Override
     public synchronized void addLoggerAppender(final org.apache.logging.log4j.core.Logger logger,
-                                               final Appender appender) {
+                                               final Appender<?> appender) {
         final String name = logger.getName();
         appenders.putIfAbsent(appender.getName(), appender);
         final LoggerConfig lc = getLoggerConfig(name);
@@ -354,6 +373,7 @@ public class BaseConfiguration extends A
      * @param logger The Logger the Fo;ter will be associated with.
      * @param filter The Filter.
      */
+    @Override
     public synchronized void addLoggerFilter(final org.apache.logging.log4j.core.Logger logger, final Filter filter) {
         final String name = logger.getName();
         final LoggerConfig lc = getLoggerConfig(name);
@@ -378,6 +398,7 @@ public class BaseConfiguration extends A
      * @param logger The Logger the Appender will be associated with.
      * @param additive True if the LoggerConfig should be additive, false otherwise.
      */
+    @Override
     public synchronized void setLoggerAdditive(final org.apache.logging.log4j.core.Logger logger,
                                                final boolean additive) {
         final String name = logger.getName();
@@ -416,6 +437,7 @@ public class BaseConfiguration extends A
      * @param name The Logger name.
      * @return The located LoggerConfig.
      */
+    @Override
     public LoggerConfig getLoggerConfig(final String name) {
         if (loggers.containsKey(name)) {
             return loggers.get(name);
@@ -441,6 +463,7 @@ public class BaseConfiguration extends A
      * Returns a Map of all the LoggerConfigs.
      * @return a Map with each entry containing the name of the Logger and the LoggerConfig.
      */
+    @Override
     public Map<String, LoggerConfig> getLoggers() {
         return Collections.unmodifiableMap(loggers);
     }
@@ -487,6 +510,7 @@ public class BaseConfiguration extends A
         setParents();
     }
 
+    @Override
     public void createConfiguration(final Node node, final LogEvent event) {
         final PluginType type = node.getType();
         if (type != null && type.isDeferChildren()) {
@@ -527,6 +551,7 @@ public class BaseConfiguration extends A
 
         if (Map.class.isAssignableFrom(clazz)) {
             try {
+                @SuppressWarnings("unchecked")
                 final Map<String, Object> map = (Map<String, Object>) clazz.newInstance();
                 for (final Node child : node.getChildren()) {
                     map.put(child.getName(), child.getObject());
@@ -540,6 +565,7 @@ public class BaseConfiguration extends A
 
         if (List.class.isAssignableFrom(clazz)) {
             try {
+                @SuppressWarnings("unchecked")
                 final List<Object> list = (List<Object>) clazz.newInstance();
                 for (final Node child : node.getChildren()) {
                     list.add(child.getObject());
@@ -621,7 +647,7 @@ public class BaseConfiguration extends A
                     final PluginElement elem = (PluginElement) a;
                     final String name = elem.value();
                     if (parmClasses[index].isArray()) {
-                        final Class parmClass = parmClasses[index].getComponentType();
+                        final Class<?> parmClass = parmClasses[index].getComponentType();
                         final List<Object> list = new ArrayList<Object>();
                         sb.append(name).append("={");
                         boolean first = true;
@@ -667,7 +693,7 @@ public class BaseConfiguration extends A
                         }
                         parms[index] = array;
                     } else {
-                        final Class parmClass = parmClasses[index];
+                        final Class<?> parmClass = parmClasses[index];
                         boolean present = false;
                         for (final Node child : children) {
                             final PluginType childType = child.getType();

Modified: logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/config/ConfigurationFactory.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/config/ConfigurationFactory.java?rev=1476703&r1=1476702&r2=1476703&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/config/ConfigurationFactory.java (original)
+++ logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/config/ConfigurationFactory.java Sun Apr 28 01:27:27 2013
@@ -111,10 +111,11 @@ public abstract class ConfigurationFacto
                     final Set<WeightedFactory> ordered = new TreeSet<WeightedFactory>();
                     for (final PluginType type : plugins.values()) {
                         try {
-                            final Class<ConfigurationFactory> clazz = type.getPluginClass();
+                            @SuppressWarnings("unchecked")
+                            final Class<ConfigurationFactory> clazz = (Class<ConfigurationFactory>)type.getPluginClass();
                             final Order order = clazz.getAnnotation(Order.class);
-                            final Integer weight = order.value();
                             if (order != null) {
+                                final Integer weight = order.value();
                                 ordered.add(new WeightedFactory(weight, clazz));
                             }
                         } catch (final Exception ex) {



Mime
View raw message