logging-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ggreg...@apache.org
Subject svn commit: r1582312 - /logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/
Date Thu, 27 Mar 2014 14:09:29 GMT
Author: ggregory
Date: Thu Mar 27 14:09:29 2014
New Revision: 1582312

URL: http://svn.apache.org/r1582312
Log:
Use final where possible.

Modified:
    logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/AbstractLogEventInput.java
    logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/AbstractSocketServer.java
    logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/JSONLogEventInput.java
    logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/SerializedLogEventInput.java
    logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/TCPSocketManager.java
    logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/TCPSocketServer.java
    logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/TLSSocketManager.java
    logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/UDPSocketServer.java
    logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/XMLLogEventInput.java

Modified: logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/AbstractLogEventInput.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/AbstractLogEventInput.java?rev=1582312&r1=1582311&r2=1582312&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/AbstractLogEventInput.java
(original)
+++ logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/AbstractLogEventInput.java
Thu Mar 27 14:09:29 2014
@@ -27,7 +27,7 @@ import java.io.InputStream;
 public abstract class AbstractLogEventInput<T extends InputStream> implements LogEventInput<T>
{
 
     @Override
-    public T wrapStream(InputStream inputStream) throws IOException {
+    public T wrapStream(final InputStream inputStream) throws IOException {
         return (T) inputStream;
     }
 

Modified: logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/AbstractSocketServer.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/AbstractSocketServer.java?rev=1582312&r1=1582311&r2=1582312&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/AbstractSocketServer.java
(original)
+++ logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/AbstractSocketServer.java
Thu Mar 27 14:09:29 2014
@@ -20,6 +20,7 @@ import java.io.File;
 import java.io.FileInputStream;
 import java.io.FileNotFoundException;
 import java.io.IOException;
+import java.io.InputStream;
 import java.net.MalformedURLException;
 import java.net.URI;
 import java.net.URL;
@@ -35,7 +36,7 @@ import org.apache.logging.log4j.core.hel
 /**
  * Abstract socket server for TCP and UDP implementations.
  */
-public abstract class AbstractSocketServer extends LogEventListener {
+public abstract class AbstractSocketServer<T extends InputStream> extends LogEventListener
{
 
     /**
      * Factory that creates a Configuration for the server.
@@ -90,9 +91,9 @@ public abstract class AbstractSocketServ
 
     private volatile boolean active = true;
 
-    protected LogEventInput logEventInput;
+    protected final LogEventInput<T> logEventInput;
 
-    public AbstractSocketServer(int port, LogEventInput logEventInput) {
+    public AbstractSocketServer(final int port, final LogEventInput<T> logEventInput)
{
         this.logger = LogManager.getLogger(this.getClass().getName() + '.' + port);
         this.logEventInput = Assert.requireNonNull(logEventInput, "LogEventInput");
     }
@@ -101,7 +102,7 @@ public abstract class AbstractSocketServ
         return this.active;
     }
 
-    protected void setActive(boolean isActive) {
+    protected void setActive(final boolean isActive) {
         this.active = isActive;
     }
 

Modified: logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/JSONLogEventInput.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/JSONLogEventInput.java?rev=1582312&r1=1582311&r2=1582312&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/JSONLogEventInput.java
(original)
+++ logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/JSONLogEventInput.java
Thu Mar 27 14:09:29 2014
@@ -27,7 +27,7 @@ import org.apache.logging.log4j.core.Log
 public class JSONLogEventInput extends AbstractLogEventInput<InputStream> {
 
     @Override
-    public LogEvent readLogEvent(InputStream inputStream) throws IOException {
+    public LogEvent readLogEvent(final InputStream inputStream) throws IOException {
         throw new UnsupportedOperationException("Not implemented yet");
     }
 

Modified: logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/SerializedLogEventInput.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/SerializedLogEventInput.java?rev=1582312&r1=1582311&r2=1582312&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/SerializedLogEventInput.java
(original)
+++ logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/SerializedLogEventInput.java
Thu Mar 27 14:09:29 2014
@@ -28,16 +28,16 @@ import org.apache.logging.log4j.core.Log
 public class SerializedLogEventInput extends AbstractLogEventInput<ObjectInputStream>
{
 
     @Override
-    public LogEvent readLogEvent(ObjectInputStream inputStream) throws IOException {
+    public LogEvent readLogEvent(final ObjectInputStream inputStream) throws IOException
{
         try {
             return (LogEvent) inputStream.readObject();
-        } catch (ClassNotFoundException e) {
+        } catch (final ClassNotFoundException e) {
             throw new IOException(e);
         }
     }
 
     @Override
-    public ObjectInputStream wrapStream(InputStream inputStream) throws IOException {
+    public ObjectInputStream wrapStream(final InputStream inputStream) throws IOException
{
         return new ObjectInputStream(inputStream);
     }
 }

Modified: logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/TCPSocketManager.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/TCPSocketManager.java?rev=1582312&r1=1582311&r2=1582312&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/TCPSocketManager.java
(original)
+++ logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/TCPSocketManager.java
Thu Mar 27 14:09:29 2014
@@ -221,11 +221,11 @@ public class TCPSocketManager extends Ab
         }
     }
 
-    protected Socket createSocket(InetAddress host, int port) throws IOException {
+    protected Socket createSocket(final InetAddress host, final int port) throws IOException
{
         return createSocket(host.getHostName(), port);
     }
 
-    protected Socket createSocket(String host, int port) throws IOException {
+    protected Socket createSocket(final String host, final int port) throws IOException {
         return new Socket(host, port);
     }
 

Modified: logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/TCPSocketServer.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/TCPSocketServer.java?rev=1582312&r1=1582311&r2=1582312&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/TCPSocketServer.java
(original)
+++ logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/TCPSocketServer.java
Thu Mar 27 14:09:29 2014
@@ -46,7 +46,7 @@ public class TCPSocketServer extends Abs
 
         private volatile boolean shutdown = false;
 
-        public SocketHandler(final Socket socket, LogEventInput logEventInput) throws IOException
{
+        public SocketHandler(final Socket socket, final LogEventInput logEventInput) throws
IOException {
             this.logEventInput = logEventInput;
             this.inputStream = logEventInput.wrapStream(socket.getInputStream());
         }
@@ -91,7 +91,7 @@ public class TCPSocketServer extends Abs
      * @return a new a socket server
      * @throws IOException if an I/O error occurs when opening the socket.
      */
-    public static TCPSocketServer createJsonSocketServer(int port) throws IOException {
+    public static TCPSocketServer createJsonSocketServer(final int port) throws IOException
{
         return new TCPSocketServer(port, new JSONLogEventInput());
     }
 
@@ -102,7 +102,7 @@ public class TCPSocketServer extends Abs
      * @return a new a socket server
      * @throws IOException if an I/O error occurs when opening the socket.
      */
-    public static TCPSocketServer createSerializedSocketServer(int port) throws IOException
{
+    public static TCPSocketServer createSerializedSocketServer(final int port) throws IOException
{
         return new TCPSocketServer(port, new SerializedLogEventInput());
     }
 
@@ -113,7 +113,7 @@ public class TCPSocketServer extends Abs
      * @return a new a socket server
      * @throws IOException if an I/O error occurs when opening the socket.
      */
-    public static TCPSocketServer createXmlSocketServer(int port) throws IOException {
+    public static TCPSocketServer createXmlSocketServer(final int port) throws IOException
{
         return new TCPSocketServer(port, new XMLLogEventInput());
     }
 
@@ -169,7 +169,7 @@ public class TCPSocketServer extends Abs
      * @param logEventInput the log even input
      * @throws IOException if an I/O error occurs when opening the socket.
      */
-    public TCPSocketServer(final int port, LogEventInput logEventInput) throws IOException
{
+    public TCPSocketServer(final int port, final LogEventInput logEventInput) throws IOException
{
         super(port, logEventInput);
         this.server = new ServerSocket(port);
     }

Modified: logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/TLSSocketManager.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/TLSSocketManager.java?rev=1582312&r1=1582311&r2=1582312&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/TLSSocketManager.java
(original)
+++ logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/TLSSocketManager.java
Thu Mar 27 14:09:29 2014
@@ -52,8 +52,8 @@ public class TLSSocketManager extends TC
      * @param immediateFail
      * @param layout        The Layout.
      */
-    public TLSSocketManager(String name, OutputStream os, Socket sock, SSLConfiguration sslConfig,
InetAddress addr,
-                            String host, int port, int delay, boolean immediateFail, Layout
layout) {
+    public TLSSocketManager(final String name, final OutputStream os, final Socket sock,
final SSLConfiguration sslConfig, final InetAddress addr,
+                            final String host, final int port, final int delay, final boolean
immediateFail, final Layout layout) {
         super(name, os, sock, addr, host, port, delay, immediateFail, layout);
         this.sslConfig = sslConfig;
     }
@@ -66,8 +66,8 @@ public class TLSSocketManager extends TC
         private final boolean immediateFail;
         private final Layout layout;
 
-        public TLSFactoryData(SSLConfiguration sslConfig, String host, int port, int delay,
boolean immediateFail,
-                              Layout layout) {
+        public TLSFactoryData(final SSLConfiguration sslConfig, final String host, final
int port, final int delay, final boolean immediateFail,
+                              final Layout layout) {
             this.host = host;
             this.port = port;
             this.delay = delay;
@@ -93,12 +93,12 @@ public class TLSSocketManager extends TC
     }
 
     @Override
-    protected Socket createSocket(String host, int port) throws IOException {
-        SSLSocketFactory socketFactory = createSSLSocketFactory(sslConfig);
+    protected Socket createSocket(final String host, final int port) throws IOException {
+        final SSLSocketFactory socketFactory = createSSLSocketFactory(sslConfig);
         return socketFactory.createSocket(host, port);
     }
 
-    private static SSLSocketFactory createSSLSocketFactory(SSLConfiguration sslConf) {
+    private static SSLSocketFactory createSSLSocketFactory(final SSLConfiguration sslConf)
{
         SSLSocketFactory socketFactory;
 
         if (sslConf != null) {
@@ -130,17 +130,17 @@ public class TLSSocketManager extends TC
                 os = socket.getOutputStream();
                 checkDelay(data.delay, os);
             }
-            catch (IOException e) {
+            catch (final IOException e) {
                 LOGGER.error("TLSSocketManager (" + name + ") " + e);
                 os = new ByteArrayOutputStream();
             }
-            catch (TLSSocketManagerFactoryException e) {
+            catch (final TLSSocketManagerFactoryException e) {
                 return null;
             }
             return createManager(name, os, socket, data.sslConfig, address, data.host, data.port,
data.delay, data.immediateFail, data.layout);
         }
 
-        private InetAddress resolveAddress(String hostName) throws TLSSocketManagerFactoryException
{
+        private InetAddress resolveAddress(final String hostName) throws TLSSocketManagerFactoryException
{
             InetAddress address;
 
             try {
@@ -153,13 +153,13 @@ public class TLSSocketManager extends TC
             return address;
         }
 
-        private void checkDelay(int delay, OutputStream os) throws TLSSocketManagerFactoryException
{
+        private void checkDelay(final int delay, final OutputStream os) throws TLSSocketManagerFactoryException
{
             if (delay == 0 && os == null) {
                 throw new TLSSocketManagerFactoryException();
             }
         }
 
-        private Socket createSocket(TLSFactoryData data) throws IOException {
+        private Socket createSocket(final TLSFactoryData data) throws IOException {
             SSLSocketFactory socketFactory;
             SSLSocket socket;
 
@@ -168,7 +168,7 @@ public class TLSSocketManager extends TC
             return socket;
         }
 
-        private TLSSocketManager createManager(String name, OutputStream os, Socket socket,
SSLConfiguration sslConfig, InetAddress address, String host, int port, int delay, boolean
immediateFail, Layout layout) {
+        private TLSSocketManager createManager(final String name, final OutputStream os,
final Socket socket, final SSLConfiguration sslConfig, final InetAddress address, final String
host, final int port, final int delay, final boolean immediateFail, final Layout layout) {
             return new TLSSocketManager(name, os, socket, sslConfig, address, host, port,
delay, immediateFail, layout);
         }
     }

Modified: logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/UDPSocketServer.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/UDPSocketServer.java?rev=1582312&r1=1582311&r2=1582312&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/UDPSocketServer.java
(original)
+++ logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/UDPSocketServer.java
Thu Mar 27 14:09:29 2014
@@ -39,7 +39,7 @@ public class UDPSocketServer extends Abs
      * @return a new a socket server
      * @throws IOException if an I/O error occurs when opening the socket.
      */
-    public static UDPSocketServer createJsonSocketServer(int port) throws IOException {
+    public static UDPSocketServer createJsonSocketServer(final int port) throws IOException
{
         return new UDPSocketServer(port, new JSONLogEventInput());
     }
 
@@ -50,7 +50,7 @@ public class UDPSocketServer extends Abs
      * @return a new a socket server
      * @throws IOException if an I/O error occurs when opening the socket.
      */
-    public static UDPSocketServer createSerializedSocketServer(int port) throws IOException
{
+    public static UDPSocketServer createSerializedSocketServer(final int port) throws IOException
{
         return new UDPSocketServer(port, new SerializedLogEventInput());
     }
 
@@ -61,7 +61,7 @@ public class UDPSocketServer extends Abs
      * @return a new a socket server
      * @throws IOException if an I/O error occurs when opening the socket.
      */
-    public static UDPSocketServer createXmlSocketServer(int port) throws IOException {
+    public static UDPSocketServer createXmlSocketServer(final int port) throws IOException
{
         return new UDPSocketServer(port, new XMLLogEventInput());
     }
 
@@ -77,7 +77,7 @@ public class UDPSocketServer extends Abs
      * @param logEventInput
      * @throws IOException If an error occurs.
      */
-    public UDPSocketServer(final int port, LogEventInput logEventInput) throws IOException
{
+    public UDPSocketServer(final int port, final LogEventInput logEventInput) throws IOException
{
         super(port, logEventInput);
         this.datagramSocket = new DatagramSocket(port);
     }

Modified: logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/XMLLogEventInput.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/XMLLogEventInput.java?rev=1582312&r1=1582311&r2=1582312&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/XMLLogEventInput.java
(original)
+++ logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/net/XMLLogEventInput.java
Thu Mar 27 14:09:29 2014
@@ -27,7 +27,7 @@ import org.apache.logging.log4j.core.Log
 public class XMLLogEventInput extends AbstractLogEventInput<InputStream> {
 
     @Override
-    public LogEvent readLogEvent(InputStream inputStream) throws IOException {
+    public LogEvent readLogEvent(final InputStream inputStream) throws IOException {
         throw new UnsupportedOperationException("Not implemented yet");
     }
 



Mime
View raw message