You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by gg...@apache.org on 2014/06/25 06:27:22 UTC

svn commit: r1605259 - in /logging/log4j/log4j2/trunk: log4j-jcl/src/main/java/org/apache/logging/log4j/jcl/ log4j-jmx-gui/src/main/java/org/apache/logging/log4j/jmx/gui/ log4j-nosql/src/main/java/org/apache/logging/log4j/nosql/appender/ log4j-nosql/sr...

Author: ggregory
Date: Wed Jun 25 04:27:22 2014
New Revision: 1605259

URL: http://svn.apache.org/r1605259
Log:
Use final.

Modified:
    logging/log4j/log4j2/trunk/log4j-jcl/src/main/java/org/apache/logging/log4j/jcl/Log4jLog.java
    logging/log4j/log4j2/trunk/log4j-jmx-gui/src/main/java/org/apache/logging/log4j/jmx/gui/Client.java
    logging/log4j/log4j2/trunk/log4j-jmx-gui/src/main/java/org/apache/logging/log4j/jmx/gui/ClientGui.java
    logging/log4j/log4j2/trunk/log4j-nosql/src/main/java/org/apache/logging/log4j/nosql/appender/NoSqlDatabaseManager.java
    logging/log4j/log4j2/trunk/log4j-nosql/src/main/java/org/apache/logging/log4j/nosql/appender/mongodb/MongoDbConnection.java
    logging/log4j/log4j2/trunk/log4j-nosql/src/test/java/org/apache/logging/log4j/nosql/appender/NoSqlDatabaseManagerTest.java

Modified: logging/log4j/log4j2/trunk/log4j-jcl/src/main/java/org/apache/logging/log4j/jcl/Log4jLog.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-jcl/src/main/java/org/apache/logging/log4j/jcl/Log4jLog.java?rev=1605259&r1=1605258&r2=1605259&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/log4j-jcl/src/main/java/org/apache/logging/log4j/jcl/Log4jLog.java (original)
+++ logging/log4j/log4j2/trunk/log4j-jcl/src/main/java/org/apache/logging/log4j/jcl/Log4jLog.java Wed Jun 25 04:27:22 2014
@@ -67,62 +67,62 @@ public class Log4jLog implements Log, Se
     }
 
     @Override
-    public void trace(Object message) {
+    public void trace(final Object message) {
         logger.logIfEnabled(FQCN, Level.TRACE, null, message, null);
     }
 
     @Override
-    public void trace(Object message, Throwable t) {
+    public void trace(final Object message, final Throwable t) {
         logger.logIfEnabled(FQCN, Level.TRACE, null, message, t);
     }
 
     @Override
-    public void debug(Object message) {
+    public void debug(final Object message) {
         logger.logIfEnabled(FQCN, Level.DEBUG, null, message, null);
     }
 
     @Override
-    public void debug(Object message, Throwable t) {
+    public void debug(final Object message, final Throwable t) {
         logger.logIfEnabled(FQCN, Level.DEBUG, null, message, t);
     }
 
     @Override
-    public void info(Object message) {
+    public void info(final Object message) {
         logger.logIfEnabled(FQCN, Level.INFO, null, message, null);
     }
 
     @Override
-    public void info(Object message, Throwable t) {
+    public void info(final Object message, final Throwable t) {
         logger.logIfEnabled(FQCN, Level.INFO, null, message, t);
     }
 
     @Override
-    public void warn(Object message) {
+    public void warn(final Object message) {
         logger.logIfEnabled(FQCN, Level.WARN, null, message, null);
     }
 
     @Override
-    public void warn(Object message, Throwable t) {
+    public void warn(final Object message, final Throwable t) {
         logger.logIfEnabled(FQCN, Level.WARN, null, message, t);
     }
 
     @Override
-    public void error(Object message) {
+    public void error(final Object message) {
         logger.logIfEnabled(FQCN, Level.ERROR, null, message, null);
     }
 
     @Override
-    public void error(Object message, Throwable t) {
+    public void error(final Object message, final Throwable t) {
         logger.logIfEnabled(FQCN, Level.ERROR, null, message, t);
     }
 
     @Override
-    public void fatal(Object message) {
+    public void fatal(final Object message) {
         logger.logIfEnabled(FQCN, Level.FATAL, null, message, null);
     }
 
     @Override
-    public void fatal(Object message, Throwable t) {
+    public void fatal(final Object message, final Throwable t) {
         logger.logIfEnabled(FQCN, Level.FATAL, null, message, t);
     }
 }

Modified: logging/log4j/log4j2/trunk/log4j-jmx-gui/src/main/java/org/apache/logging/log4j/jmx/gui/Client.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-jmx-gui/src/main/java/org/apache/logging/log4j/jmx/gui/Client.java?rev=1605259&r1=1605258&r2=1605259&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/log4j-jmx-gui/src/main/java/org/apache/logging/log4j/jmx/gui/Client.java (original)
+++ logging/log4j/log4j2/trunk/log4j-jmx-gui/src/main/java/org/apache/logging/log4j/jmx/gui/Client.java Wed Jun 25 04:27:22 2014
@@ -76,7 +76,7 @@ public class Client {
     private void init() throws MalformedObjectNameException, IOException {
     }
 
-    private Set<ObjectName> find(String pattern) throws JMException, IOException {
+    private Set<ObjectName> find(final String pattern) throws JMException, IOException {
         final ObjectName search = new ObjectName(String.format(pattern, "*"));
         final Set<ObjectName> result = connection.queryNames(search, null);
         return result;
@@ -91,7 +91,7 @@ public class Client {
      * @throws JMException If a management error occurred
      */
     public List<LoggerContextAdminMBean> getLoggerContextAdmins() throws JMException, IOException {
-        List<LoggerContextAdminMBean> result = new ArrayList<LoggerContextAdminMBean>();
+        final List<LoggerContextAdminMBean> result = new ArrayList<LoggerContextAdminMBean>();
         final Set<ObjectName> contextNames = find(LoggerContextAdminMBean.PATTERN);
         for (final ObjectName contextName : contextNames) {
             result.add(getLoggerContextAdmin(contextName));
@@ -99,7 +99,7 @@ public class Client {
         return result;
     }
 
-    public LoggerContextAdminMBean getLoggerContextAdmin(ObjectName name) {
+    public LoggerContextAdminMBean getLoggerContextAdmin(final ObjectName name) {
         final LoggerContextAdminMBean ctx = JMX.newMBeanProxy(connection, //
                 name, //
                 LoggerContextAdminMBean.class, false);
@@ -137,7 +137,7 @@ public class Client {
      * @throws MalformedObjectNameException If an object name is malformed
      * @throws IOException If an I/O error occurred
      */
-    public StatusLoggerAdminMBean getStatusLoggerAdmin(String contextName)
+    public StatusLoggerAdminMBean getStatusLoggerAdmin(final String contextName)
             throws MalformedObjectNameException, IOException {
         final String pattern = StatusLoggerAdminMBean.PATTERN;
         final String mbean = String.format(pattern, Server.escape(contextName));
@@ -163,7 +163,7 @@ public class Client {
      * @return {@code true} if the specified {@code ObjectName} is for a
      *         {@code LoggerContextAdminMBean}, {@code false} otherwise
      */
-    public boolean isLoggerContext(ObjectName mbeanName) {
+    public boolean isLoggerContext(final ObjectName mbeanName) {
         return Server.DOMAIN.equals(mbeanName.getDomain()) //
                 && mbeanName.getKeyPropertyList().containsKey("type") //
                 && mbeanName.getKeyPropertyList().size() == 1;
@@ -177,7 +177,7 @@ public class Client {
      *            {@code LoggerContextAdminMBean}
      * @return {@code ObjectName} of the {@code StatusLoggerAdminMBean}
      */
-    public ObjectName getStatusLoggerObjectName(ObjectName loggerContextObjName) {
+    public ObjectName getStatusLoggerObjectName(final ObjectName loggerContextObjName) {
         if (!isLoggerContext(loggerContextObjName)) {
             throw new IllegalArgumentException("Not a LoggerContext: " + loggerContextObjName);
         }
@@ -185,7 +185,7 @@ public class Client {
         final String name = String.format(StatusLoggerAdminMBean.PATTERN, cxtName);
         try {
             return new ObjectName(name);
-        } catch (MalformedObjectNameException ex) {
+        } catch (final MalformedObjectNameException ex) {
             throw new IllegalStateException(name, ex);
         }
     }

Modified: logging/log4j/log4j2/trunk/log4j-jmx-gui/src/main/java/org/apache/logging/log4j/jmx/gui/ClientGui.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-jmx-gui/src/main/java/org/apache/logging/log4j/jmx/gui/ClientGui.java?rev=1605259&r1=1605258&r2=1605259&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/log4j-jmx-gui/src/main/java/org/apache/logging/log4j/jmx/gui/ClientGui.java (original)
+++ logging/log4j/log4j2/trunk/log4j-jmx-gui/src/main/java/org/apache/logging/log4j/jmx/gui/ClientGui.java Wed Jun 25 04:27:22 2014
@@ -81,8 +81,8 @@ public class ClientGui extends JPanel im
         populateWidgets();
 
         // register for Notifications if LoggerContext MBean was added/removed
-        ObjectName addRemoveNotifs = MBeanServerDelegate.DELEGATE_NAME;
-        NotificationFilterSupport filter = new NotificationFilterSupport();
+        final ObjectName addRemoveNotifs = MBeanServerDelegate.DELEGATE_NAME;
+        final NotificationFilterSupport filter = new NotificationFilterSupport();
         filter.enableType(Server.DOMAIN); // only interested in Log4J2 MBeans
         client.getConnection().addNotificationListener(addRemoveNotifs, this, null, null);
     }
@@ -101,21 +101,21 @@ public class ClientGui extends JPanel im
 
     private void addWidgetForLoggerContext(final LoggerContextAdminMBean ctx) throws MalformedObjectNameException,
             IOException, InstanceNotFoundException {
-        JTabbedPane contextTabs = new JTabbedPane();
+        final JTabbedPane contextTabs = new JTabbedPane();
         contextObjNameToTabbedPaneMap.put(ctx.getObjectName(), contextTabs);
         tabbedPaneContexts.addTab("LoggerContext: " + ctx.getName(), contextTabs);
 
-        String contextName = ctx.getName();
-        StatusLoggerAdminMBean status = client.getStatusLoggerAdmin(contextName);
+        final String contextName = ctx.getName();
+        final StatusLoggerAdminMBean status = client.getStatusLoggerAdmin(contextName);
         if (status != null) {
-            JTextArea text = createTextArea();
+            final JTextArea text = createTextArea();
             final String[] messages = status.getStatusDataHistory();
             for (final String message : messages) {
                 text.append(message + '\n');
             }
             statusLogTextAreaMap.put(ctx.getObjectName(), text);
             registerListeners(status);
-            JScrollPane scroll = scroll(text);
+            final JScrollPane scroll = scroll(text);
             contextTabs.addTab("StatusLogger", scroll);
         }
 
@@ -123,8 +123,8 @@ public class ClientGui extends JPanel im
         contextTabs.addTab("Configuration", editor);
     }
 
-    private void removeWidgetForLoggerContext(ObjectName loggerContextObjName) throws JMException, IOException {
-        Component tab = contextObjNameToTabbedPaneMap.get(loggerContextObjName);
+    private void removeWidgetForLoggerContext(final ObjectName loggerContextObjName) throws JMException, IOException {
+        final Component tab = contextObjNameToTabbedPaneMap.get(loggerContextObjName);
         if (tab != null) {
             tabbedPaneContexts.remove(tab);
         }
@@ -133,12 +133,12 @@ public class ClientGui extends JPanel im
         try {
             // System.out.println("Remove listener for " + objName);
             client.getConnection().removeNotificationListener(objName, this);
-        } catch (ListenerNotFoundException ignored) {
+        } catch (final ListenerNotFoundException ignored) {
         }
     }
 
     private JTextArea createTextArea() {
-        JTextArea result = new JTextArea();
+        final JTextArea result = new JTextArea();
         result.setEditable(false);
         result.setBackground(this.getBackground());
         result.setForeground(Color.black);
@@ -166,7 +166,7 @@ public class ClientGui extends JPanel im
         return scrollStatusLog;
     }
 
-    private void registerListeners(StatusLoggerAdminMBean status) throws InstanceNotFoundException,
+    private void registerListeners(final StatusLoggerAdminMBean status) throws InstanceNotFoundException,
             MalformedObjectNameException, IOException {
         final NotificationFilterSupport filter = new NotificationFilterSupport();
         filter.enableType(StatusLoggerAdminMBean.NOTIF_TYPE_MESSAGE);
@@ -187,15 +187,15 @@ public class ClientGui extends JPanel im
 
     private void handleNotificationInAwtEventThread(final Notification notif, final Object paramObject) {
         if (StatusLoggerAdminMBean.NOTIF_TYPE_MESSAGE.equals(notif.getType())) {
-            JTextArea text = statusLogTextAreaMap.get(paramObject);
+            final JTextArea text = statusLogTextAreaMap.get(paramObject);
             if (text != null) {
                 text.append(notif.getMessage() + '\n');
             }
             return;
         }
         if (notif instanceof MBeanServerNotification) {
-            MBeanServerNotification mbsn = (MBeanServerNotification) notif;
-            ObjectName mbeanName = mbsn.getMBeanName();
+            final MBeanServerNotification mbsn = (MBeanServerNotification) notif;
+            final ObjectName mbeanName = mbsn.getMBeanName();
             if (MBeanServerNotification.REGISTRATION_NOTIFICATION.equals(notif.getType())) {
                 onMBeanRegistered(mbeanName);
             } else if (MBeanServerNotification.UNREGISTRATION_NOTIFICATION.equals(notif.getType())) {
@@ -209,12 +209,12 @@ public class ClientGui extends JPanel im
      *
      * @param mbeanName ObjectName of the registered Log4J2 MBean
      */
-    private void onMBeanRegistered(ObjectName mbeanName) {
+    private void onMBeanRegistered(final ObjectName mbeanName) {
         if (client.isLoggerContext(mbeanName)) {
             try {
-                LoggerContextAdminMBean ctx = client.getLoggerContextAdmin(mbeanName);
+                final LoggerContextAdminMBean ctx = client.getLoggerContextAdmin(mbeanName);
                 addWidgetForLoggerContext(ctx);
-            } catch (Exception ex) {
+            } catch (final Exception ex) {
                 handle("Could not add tab for new MBean " + mbeanName, ex);
             }
         }
@@ -225,21 +225,21 @@ public class ClientGui extends JPanel im
      *
      * @param mbeanName ObjectName of the unregistered Log4J2 MBean
      */
-    private void onMBeanUnregistered(ObjectName mbeanName) {
+    private void onMBeanUnregistered(final ObjectName mbeanName) {
         if (client.isLoggerContext(mbeanName)) {
             try {
                 removeWidgetForLoggerContext(mbeanName);
-            } catch (Exception ex) {
+            } catch (final Exception ex) {
                 handle("Could not remove tab for " + mbeanName, ex);
             }
         }
     }
 
-    private void handle(String msg, Exception ex) {
+    private void handle(final String msg, final Exception ex) {
         System.err.println(msg);
         ex.printStackTrace();
 
-        StringWriter sw = new StringWriter(INITIAL_STRING_WRITER_SIZE);
+        final StringWriter sw = new StringWriter(INITIAL_STRING_WRITER_SIZE);
         ex.printStackTrace(new PrintWriter(sw));
         JOptionPane.showMessageDialog(this, sw.toString(), msg, JOptionPane.ERROR_MESSAGE);
     }

Modified: logging/log4j/log4j2/trunk/log4j-nosql/src/main/java/org/apache/logging/log4j/nosql/appender/NoSqlDatabaseManager.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-nosql/src/main/java/org/apache/logging/log4j/nosql/appender/NoSqlDatabaseManager.java?rev=1605259&r1=1605258&r2=1605259&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/log4j-nosql/src/main/java/org/apache/logging/log4j/nosql/appender/NoSqlDatabaseManager.java (original)
+++ logging/log4j/log4j2/trunk/log4j-nosql/src/main/java/org/apache/logging/log4j/nosql/appender/NoSqlDatabaseManager.java Wed Jun 25 04:27:22 2014
@@ -59,7 +59,7 @@ public final class NoSqlDatabaseManager<
     protected void connectAndStart() {
         try {
             this.connection = this.provider.getConnection();
-        } catch (Exception e) {
+        } catch (final Exception e) {
             throw new AppenderLoggingException("Failed to get connection from NoSQL connection provider.", e);
         }
     }
@@ -83,7 +83,7 @@ public final class NoSqlDatabaseManager<
             entity.set("source", this.convertStackTraceElement(source));
         }
 
-        Marker marker = event.getMarker();
+        final Marker marker = event.getMarker();
         if (marker == null) {
             entity.set("marker", (Object) null);
         } else {
@@ -138,7 +138,7 @@ public final class NoSqlDatabaseManager<
         this.connection.insertObject(entity);
     }
 
-    private NoSqlObject<W> buildMarkerEntity(Marker marker) {
+    private NoSqlObject<W> buildMarkerEntity(final Marker marker) {
         final NoSqlObject<W> entity = this.connection.createObject();
         entity.set("name", marker.getName());
 

Modified: logging/log4j/log4j2/trunk/log4j-nosql/src/main/java/org/apache/logging/log4j/nosql/appender/mongodb/MongoDbConnection.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-nosql/src/main/java/org/apache/logging/log4j/nosql/appender/mongodb/MongoDbConnection.java?rev=1605259&r1=1605258&r2=1605259&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/log4j-nosql/src/main/java/org/apache/logging/log4j/nosql/appender/mongodb/MongoDbConnection.java (original)
+++ logging/log4j/log4j2/trunk/log4j-nosql/src/main/java/org/apache/logging/log4j/nosql/appender/mongodb/MongoDbConnection.java Wed Jun 25 04:27:22 2014
@@ -44,7 +44,7 @@ public final class MongoDbConnection imp
     static {
         BSON.addEncodingHook(Level.class, new Transformer() {
             @Override
-            public Object transform(Object o) {
+            public Object transform(final Object o) {
                 if (o instanceof Level) {
                     return ((Level) o).name();
                 }

Modified: logging/log4j/log4j2/trunk/log4j-nosql/src/test/java/org/apache/logging/log4j/nosql/appender/NoSqlDatabaseManagerTest.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-nosql/src/test/java/org/apache/logging/log4j/nosql/appender/NoSqlDatabaseManagerTest.java?rev=1605259&r1=1605258&r2=1605259&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/log4j-nosql/src/test/java/org/apache/logging/log4j/nosql/appender/NoSqlDatabaseManagerTest.java (original)
+++ logging/log4j/log4j2/trunk/log4j-nosql/src/test/java/org/apache/logging/log4j/nosql/appender/NoSqlDatabaseManagerTest.java Wed Jun 25 04:27:22 2014
@@ -97,7 +97,7 @@ public class NoSqlDatabaseManagerTest {
             try {
                 manager.writeInternal(event);
                 fail("Expected AppenderLoggingException.");
-            } catch (AppenderLoggingException ignore) {
+            } catch (final AppenderLoggingException ignore) {
                 /* */
             }
 
@@ -137,7 +137,7 @@ public class NoSqlDatabaseManagerTest {
             try {
                 manager.writeInternal(event);
                 fail("Expected AppenderLoggingException.");
-            } catch (AppenderLoggingException ignore) {
+            } catch (final AppenderLoggingException ignore) {
                 /* */
             }
         } finally {