logging-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ggreg...@apache.org
Subject svn commit: r1419697 [6/17] - in /logging/log4j/log4j2/trunk: api/src/main/java/org/apache/logging/log4j/ api/src/main/java/org/apache/logging/log4j/message/ api/src/main/java/org/apache/logging/log4j/simple/ api/src/main/java/org/apache/logging/log4j/...
Date Mon, 10 Dec 2012 19:37:03 GMT
Modified: logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/config/AppenderRef.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/config/AppenderRef.java?rev=1419697&r1=1419696&r2=1419697&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/config/AppenderRef.java (original)
+++ logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/config/AppenderRef.java Mon Dec 10 19:36:06 2012
@@ -38,7 +38,7 @@ public final class AppenderRef {
     private final Level level;
     private final Filter filter;
 
-    private AppenderRef(String ref, Level level, Filter filter) {
+    private AppenderRef(final String ref, final Level level, final Filter filter) {
         this.ref = ref;
         this.level = level;
         this.filter = filter;
@@ -64,9 +64,9 @@ public final class AppenderRef {
      * @return The name of the Appender.
      */
     @PluginFactory
-    public static AppenderRef createAppenderRef(@PluginAttr("ref") String ref,
-                                                @PluginAttr("level") String levelName,
-                                                @PluginElement("filters") Filter filter) {
+    public static AppenderRef createAppenderRef(@PluginAttr("ref") final String ref,
+                                                @PluginAttr("level") final String levelName,
+                                                @PluginElement("filters") final Filter filter) {
 
         if (ref == null) {
             LOGGER.error("Appender references must contain a reference");

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=1419697&r1=1419696&r2=1419697&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 Mon Dec 10 19:36:06 2012
@@ -87,15 +87,15 @@ public class BaseConfiguration extends A
 
     private ConcurrentMap<String, LoggerConfig> loggers = new ConcurrentHashMap<String, LoggerConfig>();
 
-    private StrLookup tempLookup = new Interpolator();
+    private final StrLookup tempLookup = new Interpolator();
 
-    private StrSubstitutor subst = new StrSubstitutor(tempLookup);
+    private final StrSubstitutor subst = new StrSubstitutor(tempLookup);
 
     private LoggerConfig root = new LoggerConfig();
 
-    private boolean started = false;
+    private final boolean started = false;
 
-    private ConcurrentMap<String, Object> componentMap = new ConcurrentHashMap<String, Object>();
+    private final ConcurrentMap<String, Object> componentMap = new ConcurrentHashMap<String, Object>();
 
     /**
      * Constructor.
@@ -112,10 +112,10 @@ public class BaseConfiguration extends A
         pluginManager.collectPlugins();
         setup();
         doConfigure();
-        for (LoggerConfig logger : loggers.values()) {
+        for (final LoggerConfig logger : loggers.values()) {
             logger.startFilter();
         }
-        for (Appender appender : appenders.values()) {
+        for (final Appender appender : appenders.values()) {
             appender.start();
         }
 
@@ -126,12 +126,12 @@ public class BaseConfiguration extends A
      * Tear down the configuration.
      */
     public void stop() {
-        for (LoggerConfig logger : loggers.values()) {
+        for (final LoggerConfig logger : loggers.values()) {
             logger.clearAppenders();
             logger.stopFilter();
         }
         // Stop the appenders in reverse order in case they still have activity.
-        Appender[] array = appenders.values().toArray(new Appender[appenders.size()]);
+        final Appender[] array = appenders.values().toArray(new Appender[appenders.size()]);
         for (int i = array.length - 1; i > 0; --i) {
             array[i].stop();
         }
@@ -141,18 +141,18 @@ public class BaseConfiguration extends A
     protected void setup() {
     }
 
-    public Object getComponent(String name) {
+    public Object getComponent(final String name) {
         return componentMap.get(name);
     }
 
-    public void addComponent(String name, Object obj) {
+    public void addComponent(final String name, final Object obj) {
         componentMap.putIfAbsent(name, obj);
     }
 
     protected void doConfigure() {
         boolean setRoot = false;
         boolean setLoggers = false;
-        for (Node child : rootNode.getChildren()) {
+        for (final Node child : rootNode.getChildren()) {
             createConfiguration(child, null);
             if (child.getObject() == null) {
                 continue;
@@ -172,7 +172,7 @@ public class BaseConfiguration extends A
             } else if (child.getObject() instanceof Filter) {
                 addFilter((Filter) child.getObject());
             } else if (child.getName().equalsIgnoreCase("loggers")) {
-                Loggers l = (Loggers) child.getObject();
+                final Loggers l = (Loggers) child.getObject();
                 loggers = l.getMap();
                 setLoggers = true;
                 if (l.getRoot() != null) {
@@ -195,10 +195,10 @@ public class BaseConfiguration extends A
             return;
         }
 
-        for (Map.Entry<String, LoggerConfig> entry : loggers.entrySet()) {
-            LoggerConfig l = entry.getValue();
-            for (AppenderRef ref : l.getAppenderRefs()) {
-                Appender app = appenders.get(ref.getRef());
+        for (final Map.Entry<String, LoggerConfig> entry : loggers.entrySet()) {
+            final LoggerConfig l = entry.getValue();
+            for (final AppenderRef ref : l.getAppenderRefs()) {
+                final Appender app = appenders.get(ref.getRef());
                 if (app != null) {
                     l.addAppender(app, ref.getLevel(), ref.getFilter());
                 } else {
@@ -213,16 +213,16 @@ public class BaseConfiguration extends A
 
     private void setToDefault() {
         setName(DefaultConfiguration.DEFAULT_NAME);
-        Layout layout = PatternLayout.createLayout("%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n",
+        final Layout layout = PatternLayout.createLayout("%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n",
             null, null, null);
-        Appender appender = ConsoleAppender.createAppender(layout, null, "SYSTEM_OUT", "Console", "false", "true");
+        final Appender appender = ConsoleAppender.createAppender(layout, null, "SYSTEM_OUT", "Console", "false", "true");
         appender.start();
         addAppender(appender);
-        LoggerConfig root = getRootLogger();
+        final LoggerConfig root = getRootLogger();
         root.addAppender(appender, null, null);
 
-        String levelName = System.getProperty(DefaultConfiguration.DEFAULT_LEVEL);
-        Level level = levelName != null && Level.valueOf(levelName) != null ? Level.valueOf(levelName) : Level.ERROR;
+        final String levelName = System.getProperty(DefaultConfiguration.DEFAULT_LEVEL);
+        final Level level = levelName != null && Level.valueOf(levelName) != null ? Level.valueOf(levelName) : Level.ERROR;
         root.setLevel(level);
     }
 
@@ -234,7 +234,7 @@ public class BaseConfiguration extends A
      * Set the name of the configuration.
      * @param name The name.
      */
-    public void setName(String name) {
+    public void setName(final String name) {
         this.name = name;
     }
 
@@ -250,7 +250,7 @@ public class BaseConfiguration extends A
      * Add a listener for changes on the configuration.
      * @param listener The ConfigurationListener to add.
      */
-    public void addListener(ConfigurationListener listener) {
+    public void addListener(final ConfigurationListener listener) {
         listeners.add(listener);
     }
 
@@ -258,7 +258,7 @@ public class BaseConfiguration extends A
      * Remove a ConfigurationListener.
      * @param listener The ConfigurationListener to remove.
      */
-    public void removeListener(ConfigurationListener listener) {
+    public void removeListener(final ConfigurationListener listener) {
         listeners.remove(listener);
     }
 
@@ -267,7 +267,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(String name) {
+    public Appender getAppender(final String name) {
         return appenders.get(name);
     }
 
@@ -283,7 +283,7 @@ public class BaseConfiguration extends A
      * Adds an Appender to the configuration.
      * @param appender The Appender to add.
      */
-    public void addAppender(Appender appender) {
+    public void addAppender(final Appender appender) {
         appenders.put(appender.getName(), appender);
     }
 
@@ -304,14 +304,14 @@ public class BaseConfiguration extends A
      * @param logger The Logger the Appender will be associated with.
      * @param appender The Appender.
      */
-    public synchronized void addLoggerAppender(org.apache.logging.log4j.core.Logger logger, Appender appender) {
-        String name = logger.getName();
+    public synchronized void addLoggerAppender(final org.apache.logging.log4j.core.Logger logger, final Appender appender) {
+        final String name = logger.getName();
         appenders.putIfAbsent(name, appender);
-        LoggerConfig lc = getLoggerConfig(name);
+        final LoggerConfig lc = getLoggerConfig(name);
         if (lc.getName().equals(name)) {
             lc.addAppender(appender, null, null);
         } else {
-            LoggerConfig nlc = new LoggerConfig(name, lc.getLevel(), lc.isAdditive());
+            final LoggerConfig nlc = new LoggerConfig(name, lc.getLevel(), lc.isAdditive());
             nlc.addAppender(appender, null, null);
             nlc.setParent(lc);
             loggers.putIfAbsent(name, nlc);
@@ -328,14 +328,14 @@ public class BaseConfiguration extends A
      * @param logger The Logger the Fo;ter will be associated with.
      * @param filter The Filter.
      */
-    public synchronized void addLoggerFilter(org.apache.logging.log4j.core.Logger logger, Filter filter) {
-        String name = logger.getName();
-        LoggerConfig lc = getLoggerConfig(name);
+    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);
         if (lc.getName().equals(name)) {
 
             lc.addFilter(filter);
         } else {
-            LoggerConfig nlc = new LoggerConfig(name, lc.getLevel(), lc.isAdditive());
+            final LoggerConfig nlc = new LoggerConfig(name, lc.getLevel(), lc.isAdditive());
             nlc.addFilter(filter);
             nlc.setParent(lc);
             loggers.putIfAbsent(name, nlc);
@@ -352,13 +352,13 @@ 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.
      */
-    public synchronized void setLoggerAdditive(org.apache.logging.log4j.core.Logger logger, boolean additive) {
-        String name = logger.getName();
-        LoggerConfig lc = getLoggerConfig(name);
+    public synchronized void setLoggerAdditive(final org.apache.logging.log4j.core.Logger logger, final boolean additive) {
+        final String name = logger.getName();
+        final LoggerConfig lc = getLoggerConfig(name);
         if (lc.getName().equals(name)) {
             lc.setAdditive(additive);
         } else {
-            LoggerConfig nlc = new LoggerConfig(name, lc.getLevel(), additive);
+            final LoggerConfig nlc = new LoggerConfig(name, lc.getLevel(), additive);
             nlc.setParent(lc);
             loggers.putIfAbsent(name, nlc);
             setParents();
@@ -372,11 +372,11 @@ public class BaseConfiguration extends A
      * case an Appender with the same name is being added during the removal.
      * @param name the name of the appender to remove.
      */
-    public synchronized void removeAppender(String name) {
-        for (LoggerConfig logger : loggers.values()) {
+    public synchronized void removeAppender(final String name) {
+        for (final LoggerConfig logger : loggers.values()) {
             logger.removeAppender(name);
         }
-        Appender app = appenders.remove(name);
+        final Appender app = appenders.remove(name);
 
         if (app != null) {
             app.stop();
@@ -389,7 +389,7 @@ public class BaseConfiguration extends A
      * @param name The Logger name.
      * @return The located LoggerConfig.
      */
-    public LoggerConfig getLoggerConfig(String name) {
+    public LoggerConfig getLoggerConfig(final String name) {
         if (loggers.containsKey(name)) {
             return loggers.get(name);
         }
@@ -423,7 +423,7 @@ public class BaseConfiguration extends A
      * @param name The Logger name.
      * @return The LoggerConfig or null if no match was found.
      */
-    public LoggerConfig getLogger(String name) {
+    public LoggerConfig getLogger(final String name) {
         return loggers.get(name);
     }
 
@@ -434,9 +434,9 @@ public class BaseConfiguration extends A
      * @param name The name of the Logger.
      * @param loggerConfig The LoggerConfig.
      */
-    public void addLogger(String name, LoggerConfig loggerConfig) {
+    public void addLogger(final String name, final LoggerConfig loggerConfig) {
         if (started) {
-            String msg = "Cannot add logger " + name + " to an active configuration";
+            final String msg = "Cannot add logger " + name + " to an active configuration";
             LOGGER.warn(msg);
             throw new IllegalStateException(msg);
         }
@@ -450,9 +450,9 @@ public class BaseConfiguration extends A
      *
      * @param name The name of the Logger.
      */
-    public void removeLogger(String name) {
+    public void removeLogger(final String name) {
         if (started) {
-            String msg = "Cannot remove logger " + name + " in an active configuration";
+            final String msg = "Cannot remove logger " + name + " in an active configuration";
             LOGGER.warn(msg);
             throw new IllegalStateException(msg);
         }
@@ -460,12 +460,12 @@ public class BaseConfiguration extends A
         setParents();
     }
 
-    public void createConfiguration(Node node, LogEvent event) {
-        PluginType type = node.getType();
+    public void createConfiguration(final Node node, final LogEvent event) {
+        final PluginType type = node.getType();
         if (type != null && type.isDeferChildren()) {
             node.setObject(createPluginObject(type, node, event));
         } else {
-            for (Node child : node.getChildren()) {
+            for (final Node child : node.getChildren()) {
                 createConfiguration(child, event);
             }
 
@@ -494,18 +494,18 @@ public class BaseConfiguration extends A
     * @return the instantiate method or null if there is none by that
     * description.
     */
-    private Object createPluginObject(PluginType type, Node node, LogEvent event)
+    private Object createPluginObject(final PluginType type, final Node node, final LogEvent event)
     {
-        Class clazz = type.getPluginClass();
+        final Class clazz = type.getPluginClass();
 
         if (Map.class.isAssignableFrom(clazz)) {
             try {
-                Map<String, Object> map = (Map<String, Object>) clazz.newInstance();
-                for (Node child : node.getChildren()) {
+                final Map<String, Object> map = (Map<String, Object>) clazz.newInstance();
+                for (final Node child : node.getChildren()) {
                     map.put(child.getName(), child.getObject());
                 }
                 return map;
-            } catch (Exception ex) {
+            } catch (final Exception ex) {
                 LOGGER.warn("Unable to create Map for " + type.getElementName() + " of class " +
                     clazz);
             }
@@ -513,12 +513,12 @@ public class BaseConfiguration extends A
 
         if (List.class.isAssignableFrom(clazz)) {
             try {
-                List<Object> list = (List<Object>) clazz.newInstance();
-                for (Node child : node.getChildren()) {
+                final List<Object> list = (List<Object>) clazz.newInstance();
+                for (final Node child : node.getChildren()) {
                     list.add(child.getObject());
                 }
                 return list;
-            } catch (Exception ex) {
+            } catch (final Exception ex) {
                 LOGGER.warn("Unable to create List for " + type.getElementName() + " of class " +
                     clazz);
             }
@@ -526,7 +526,7 @@ public class BaseConfiguration extends A
 
         Method factoryMethod = null;
 
-        for (Method method : clazz.getMethods()) {
+        for (final Method method : clazz.getMethods()) {
             if (method.isAnnotationPresent(PluginFactory.class)) {
                 factoryMethod = method;
                 break;
@@ -536,18 +536,18 @@ public class BaseConfiguration extends A
             return null;
         }
 
-        Annotation[][] parmArray = factoryMethod.getParameterAnnotations();
-        Class[] parmClasses = factoryMethod.getParameterTypes();
+        final Annotation[][] parmArray = factoryMethod.getParameterAnnotations();
+        final Class[] parmClasses = factoryMethod.getParameterTypes();
         if (parmArray.length != parmClasses.length) {
             LOGGER.error("Number of parameter annotations does not equal the number of paramters");
         }
-        Object[] parms = new Object[parmClasses.length];
+        final Object[] parms = new Object[parmClasses.length];
 
         int index = 0;
-        Map<String, String> attrs = node.getAttributes();
-        List<Node> children = node.getChildren();
-        StringBuilder sb = new StringBuilder();
-        List<Node> used = new ArrayList<Node>();
+        final Map<String, String> attrs = node.getAttributes();
+        final List<Node> children = node.getChildren();
+        final StringBuilder sb = new StringBuilder();
+        final List<Node> used = new ArrayList<Node>();
 
         /*
          * For each parameter:
@@ -559,8 +559,8 @@ public class BaseConfiguration extends A
          *     Store the array into the parameter array.
          *   If not an array, store the object in the child node into the parameter array.
          */
-        for (Annotation[] parmTypes : parmArray) {
-            for (Annotation a : parmTypes) {
+        for (final Annotation[] parmTypes : parmArray) {
+            for (final Annotation a : parmTypes) {
                 if (sb.length() == 0) {
                     sb.append(" with params(");
                 } else {
@@ -577,29 +577,29 @@ public class BaseConfiguration extends A
                         sb.append("Configuration");
                     }
                 } else if (a instanceof PluginValue) {
-                    String name = ((PluginValue) a).value();
+                    final String name = ((PluginValue) a).value();
                     String v = node.getValue();
                     if (v == null) {
                         v = getAttrValue("value", attrs);
                     }
-                    String value = subst.replace(event, v);
+                    final String value = subst.replace(event, v);
                     sb.append(name).append("=\"").append(value).append("\"");
                     parms[index] = value;
                 } else if (a instanceof PluginAttr) {
-                    String name = ((PluginAttr) a).value();
-                    String value = subst.replace(event, getAttrValue(name, attrs));
+                    final String name = ((PluginAttr) a).value();
+                    final String value = subst.replace(event, getAttrValue(name, attrs));
                     sb.append(name).append("=\"").append(value).append("\"");
                     parms[index] = value;
                 } else if (a instanceof PluginElement) {
-                    PluginElement elem = (PluginElement) a;
-                    String name = elem.value();
+                    final PluginElement elem = (PluginElement) a;
+                    final String name = elem.value();
                     if (parmClasses[index].isArray()) {
-                        Class parmClass = parmClasses[index].getComponentType();
-                        List<Object> list = new ArrayList<Object>();
+                        final Class parmClass = parmClasses[index].getComponentType();
+                        final List<Object> list = new ArrayList<Object>();
                         sb.append(name).append("={");
                         boolean first = true;
-                        for (Node child : children) {
-                            PluginType childType = child.getType();
+                        for (final Node child : children) {
+                            final PluginType childType = child.getType();
                             if (elem.value().equalsIgnoreCase(childType.getElementName()) ||
                                 parmClass.isAssignableFrom(childType.getPluginClass())) {
                                 used.add(child);
@@ -607,7 +607,7 @@ public class BaseConfiguration extends A
                                     sb.append(", ");
                                 }
                                 first = false;
-                                Object obj = child.getObject();
+                                final Object obj = child.getObject();
                                 if (obj == null) {
                                     LOGGER.error("Null object returned for " + child.getName() + " in " +
                                         node.getName());
@@ -632,18 +632,18 @@ public class BaseConfiguration extends A
                                 " for attribute " + name);
                             break;
                         }
-                        Object[] array = (Object[]) Array.newInstance(parmClass, list.size());
+                        final Object[] array = (Object[]) Array.newInstance(parmClass, list.size());
                         int i = 0;
-                        for (Object obj : list) {
+                        for (final Object obj : list) {
                             array[i] = obj;
                             ++i;
                         }
                         parms[index] = array;
                     } else {
-                        Class parmClass = parmClasses[index];
+                        final Class parmClass = parmClasses[index];
                         boolean present = false;
-                        for (Node child : children) {
-                            PluginType childType = child.getType();
+                        for (final Node child : children) {
+                            final PluginType childType = child.getType();
                             if (elem.value().equals(childType.getElementName()) ||
                                 parmClass.isAssignableFrom(childType.getPluginClass())) {
                                 sb.append(child.getName()).append("(").append(child.toString()).append(")");
@@ -666,8 +666,8 @@ public class BaseConfiguration extends A
         }
 
         if (attrs.size() > 0) {
-            StringBuilder eb = new StringBuilder();
-            for (String key : attrs.keySet()) {
+            final StringBuilder eb = new StringBuilder();
+            for (final String key : attrs.keySet()) {
                 if (eb.length() == 0) {
                     eb.append(node.getName());
                     eb.append(" contains ");
@@ -688,18 +688,18 @@ public class BaseConfiguration extends A
         }
 
         if (!type.isDeferChildren() && used.size() != children.size()) {
-            for (Node child : children) {
+            for (final Node child : children) {
                 if (used.contains(child)) {
                     continue;
                 }
-                String nodeType = node.getType().getElementName();
-                String start = nodeType.equals(node.getName()) ? node.getName() : nodeType + " " + node.getName();
+                final String nodeType = node.getType().getElementName();
+                final String start = nodeType.equals(node.getName()) ? node.getName() : nodeType + " " + node.getName();
                 LOGGER.error(start + " has no parameter that matches element " + child.getName());
             }
         }
 
         try {
-            int mod = factoryMethod.getModifiers();
+            final int mod = factoryMethod.getModifiers();
             if (!Modifier.isStatic(mod)) {
                 LOGGER.error(factoryMethod.getName() + " method is not static on class " +
                     clazz.getName() + " for element " + node.getName());
@@ -711,16 +711,16 @@ public class BaseConfiguration extends A
                 return factoryMethod.invoke(null, parms);
             //}
             //return factoryMethod.invoke(null, node);
-        } catch (Exception e) {
+        } catch (final Exception e) {
             LOGGER.error("Unable to invoke method " + factoryMethod.getName() + " in class " +
                 clazz.getName() + " for element " + node.getName(), e);
         }
         return null;
     }
 
-    private void printArray(StringBuilder sb, Object... array) {
+    private void printArray(final StringBuilder sb, final Object... array) {
         boolean first = true;
-        for (Object obj : array) {
+        for (final Object obj : array) {
             if (!first) {
                 sb.append(", ");
             }
@@ -729,10 +729,10 @@ public class BaseConfiguration extends A
         }
     }
 
-    private String getAttrValue(String name, Map<String, String> attrs) {
-        for (String key : attrs.keySet()) {
+    private String getAttrValue(final String name, final Map<String, String> attrs) {
+        for (final String key : attrs.keySet()) {
             if (key.equalsIgnoreCase(name)) {
-                String attr = attrs.get(key);
+                final String attr = attrs.get(key);
                 attrs.remove(key);
                 return attr;
             }
@@ -741,11 +741,11 @@ public class BaseConfiguration extends A
     }
 
     private void setParents() {
-         for (Map.Entry<String, LoggerConfig> entry : loggers.entrySet()) {
-            LoggerConfig logger = entry.getValue();
+         for (final Map.Entry<String, LoggerConfig> entry : loggers.entrySet()) {
+            final LoggerConfig logger = entry.getValue();
             String name = entry.getKey();
             if (!name.equals("")) {
-                int i = name.lastIndexOf('.');
+                final int i = name.lastIndexOf('.');
                 if (i > 0) {
                     name = name.substring(0, i);
                     LoggerConfig parent = getLoggerConfig(name);

Modified: logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/config/ConfigurationException.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/config/ConfigurationException.java?rev=1419697&r1=1419696&r2=1419697&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/config/ConfigurationException.java (original)
+++ logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/config/ConfigurationException.java Mon Dec 10 19:36:06 2012
@@ -21,11 +21,11 @@ package org.apache.logging.log4j.core.co
  */
 public class ConfigurationException extends RuntimeException {
 
-    public ConfigurationException(String msg) {
+    public ConfigurationException(final String msg) {
         super(msg);
     }
 
-    public ConfigurationException(String msg, Exception ex) {
+    public ConfigurationException(final String msg, final Exception ex) {
         super(msg, ex);
     }
 }

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=1419697&r1=1419696&r2=1419697&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 Mon Dec 10 19:36:06 2012
@@ -94,47 +94,47 @@ public abstract class ConfigurationFacto
      * @return the ConfigurationFactory.
      */
     public static ConfigurationFactory getInstance() {
-        String factoryClass = System.getProperty(CONFIGURATION_FACTORY_PROPERTY);
+        final String factoryClass = System.getProperty(CONFIGURATION_FACTORY_PROPERTY);
         if (factoryClass != null) {
             addFactory(factoryClass);
         }
-        PluginManager manager = new PluginManager("ConfigurationFactory");
+        final PluginManager manager = new PluginManager("ConfigurationFactory");
         manager.collectPlugins();
-        Map<String, PluginType> plugins = manager.getPlugins();
-        Set<WeightedFactory> ordered = new TreeSet<WeightedFactory>();
-        for (PluginType type : plugins.values()) {
+        final Map<String, PluginType> plugins = manager.getPlugins();
+        final Set<WeightedFactory> ordered = new TreeSet<WeightedFactory>();
+        for (final PluginType type : plugins.values()) {
             try {
-                Class<ConfigurationFactory> clazz = type.getPluginClass();
-                Order o = clazz.getAnnotation(Order.class);
-                Integer weight = o.value();
+                final Class<ConfigurationFactory> clazz = type.getPluginClass();
+                final Order o = clazz.getAnnotation(Order.class);
+                final Integer weight = o.value();
                 if (o != null) {
                     ordered.add(new WeightedFactory(weight, clazz));
                 }
-            } catch (Exception ex) {
+            } catch (final Exception ex) {
               LOGGER.warn("Unable to add class " + type.getPluginClass());
             }
         }
-        for (WeightedFactory wf : ordered) {
+        for (final WeightedFactory wf : ordered) {
             addFactory(wf.factoryClass);
         }
         return configFactory;
     }
 
-    private static void addFactory(String factoryClass) {
+    private static void addFactory(final String factoryClass) {
         try {
-            Class clazz = Class.forName(factoryClass);
+            final Class clazz = Class.forName(factoryClass);
             addFactory(clazz);
-        } catch (ClassNotFoundException ex) {
+        } catch (final ClassNotFoundException ex) {
             LOGGER.error("Unable to load class " + factoryClass, ex);
-        } catch (Exception ex) {
+        } catch (final Exception ex) {
             LOGGER.error("Unable to load class " + factoryClass, ex);
         }
     }
 
-    private static void addFactory(Class factoryClass) {
+    private static void addFactory(final Class factoryClass) {
         try {
             factories.add((ConfigurationFactory) factoryClass.newInstance());
-        } catch (Exception ex) {
+        } catch (final Exception ex) {
             LOGGER.error("Unable to create instance of " + factoryClass.getName(), ex);
         }
     }
@@ -143,7 +143,7 @@ public abstract class ConfigurationFacto
      * Set the configuration factory.
      * @param factory the ConfigurationFactory.
      */
-    public static void setConfigurationFactory(ConfigurationFactory factory) {
+    public static void setConfigurationFactory(final ConfigurationFactory factory) {
         configFactory = factory;
     }
 
@@ -158,7 +158,7 @@ public abstract class ConfigurationFacto
      * Remove the ConfigurationFactory.
      * @param factory The factory to remove.
      */
-    public static void removeConfigurationFactory(ConfigurationFactory factory) {
+    public static void removeConfigurationFactory(final ConfigurationFactory factory) {
         factories.remove(factory);
     }
 
@@ -176,12 +176,12 @@ public abstract class ConfigurationFacto
      * @param configLocation The configuration location.
      * @return The Configuration.
      */
-    public Configuration getConfiguration(String name, URI configLocation) {
+    public Configuration getConfiguration(final String name, final URI configLocation) {
         if (!isActive()) {
             return null;
         }
         if (configLocation != null) {
-            ConfigurationSource source = getInputFromURI(configLocation);
+            final ConfigurationSource source = getInputFromURI(configLocation);
             if (source != null) {
                 return getConfiguration(source);
             }
@@ -194,30 +194,30 @@ public abstract class ConfigurationFacto
      * @param configLocation A URI representing the location of the configuration.
      * @return The ConfigurationSource for the configuration.
      */
-    protected ConfigurationSource getInputFromURI(URI configLocation) {
-        File configFile = FileUtils.fileFromURI(configLocation);
+    protected ConfigurationSource getInputFromURI(final URI configLocation) {
+        final File configFile = FileUtils.fileFromURI(configLocation);
         if (configFile != null && configFile.exists() && configFile.canRead()) {
             try {
                 return new ConfigurationSource(new FileInputStream(configFile), configFile);
-            } catch (FileNotFoundException ex) {
+            } catch (final FileNotFoundException ex) {
                 LOGGER.error("Cannot locate file " + configLocation.getPath(), ex);
             }
         }
-        String scheme = configLocation.getScheme();
+        final String scheme = configLocation.getScheme();
         if (scheme == null || scheme.equals("classloader")) {
-            ClassLoader loader = this.getClass().getClassLoader();
-            ConfigurationSource source = getInputFromResource(configLocation.getPath(), loader);
+            final ClassLoader loader = this.getClass().getClassLoader();
+            final ConfigurationSource source = getInputFromResource(configLocation.getPath(), loader);
             if (source != null) {
                 return source;
             }
         }
         try {
             return new ConfigurationSource(configLocation.toURL().openStream(), configLocation.getPath());
-        } catch (MalformedURLException ex) {
+        } catch (final MalformedURLException ex) {
             LOGGER.error("Invalid URL " + configLocation.toString(), ex);
-        } catch (IOException ex) {
+        } catch (final IOException ex) {
             LOGGER.error("Unable to access " + configLocation.toString(), ex);
-        } catch (Exception ex) {
+        } catch (final Exception ex) {
             LOGGER.error("Unable to access " + configLocation.toString(), ex);
         }
         return null;
@@ -229,17 +229,17 @@ public abstract class ConfigurationFacto
      * @param loader The default ClassLoader to use.
      * @return The InputSource to use to read the configuration.
      */
-    protected ConfigurationSource getInputFromString(String config, ClassLoader loader) {
+    protected ConfigurationSource getInputFromString(final String config, final ClassLoader loader) {
         try {
-            URL url = new URL(config);
+            final URL url = new URL(config);
             return new ConfigurationSource(url.openStream(), FileUtils.fileFromURI(url.toURI()));
-        } catch (Exception ex) {
-            ConfigurationSource source = getInputFromResource(config, loader);
+        } catch (final Exception ex) {
+            final ConfigurationSource source = getInputFromResource(config, loader);
             if (source == null) {
                 try {
-                    File file = new File(config);
+                    final File file = new File(config);
                     return new ConfigurationSource(new FileInputStream(file), file);
-                } catch (FileNotFoundException fnfe) {
+                } catch (final FileNotFoundException fnfe) {
                     // Ignore the exception
                 }
             }
@@ -253,15 +253,15 @@ public abstract class ConfigurationFacto
      * @param loader The default ClassLoader to use.
      * @return The ConfigurationSource for the configuration.
      */
-    protected ConfigurationSource getInputFromResource(String resource, ClassLoader loader) {
-        URL url = Loader.getResource(resource, loader);
+    protected ConfigurationSource getInputFromResource(final String resource, final ClassLoader loader) {
+        final URL url = Loader.getResource(resource, loader);
         if (url == null) {
             return null;
         }
         InputStream is = null;
         try {
             is = url.openStream();
-        } catch (IOException ioe) {
+        } catch (final IOException ioe) {
             return null;
         }
         if (is == null) {
@@ -271,7 +271,7 @@ public abstract class ConfigurationFacto
         if (FileUtils.isFile(url)) {
             try {
                 return new ConfigurationSource(is, FileUtils.fileFromURI((url.toURI())));
-            } catch (URISyntaxException ex) {
+            } catch (final URISyntaxException ex) {
                 // Just ignore the exception.
             }
         }
@@ -282,21 +282,21 @@ public abstract class ConfigurationFacto
      * Factory that chooses a ConfigurationFactory based on weighting.
      */
     private static class WeightedFactory implements Comparable<WeightedFactory> {
-        private int weight;
-        private Class<ConfigurationFactory> factoryClass;
+        private final int weight;
+        private final Class<ConfigurationFactory> factoryClass;
 
         /**
          * Constructor.
          * @param weight The weight.
          * @param clazz The class.
          */
-        public WeightedFactory(int weight, Class<ConfigurationFactory> clazz) {
+        public WeightedFactory(final int weight, final Class<ConfigurationFactory> clazz) {
             this.weight = weight;
             this.factoryClass = clazz;
         }
 
-        public int compareTo(WeightedFactory wf) {
-            int w = wf.weight;
+        public int compareTo(final WeightedFactory wf) {
+            final int w = wf.weight;
             if (weight == w) {
                 return 0;
             } else if (weight > w) {
@@ -319,20 +319,20 @@ public abstract class ConfigurationFacto
          * @return The Configuration.
          */
         @Override
-        public Configuration getConfiguration(String name, URI configLocation) {
+        public Configuration getConfiguration(final String name, final URI configLocation) {
 
             if (configLocation == null) {
-                String config = System.getProperty(CONFIGURATION_FILE_PROPERTY);
+                final String config = System.getProperty(CONFIGURATION_FILE_PROPERTY);
                 if (config != null) {
-                    ClassLoader loader = this.getClass().getClassLoader();
-                    ConfigurationSource source = getInputFromString(config, loader);
+                    final ClassLoader loader = this.getClass().getClassLoader();
+                    final ConfigurationSource source = getInputFromString(config, loader);
                     if (source != null) {
-                        for (ConfigurationFactory factory : factories) {
-                            String[] types = factory.getSupportedTypes();
+                        for (final ConfigurationFactory factory : factories) {
+                            final String[] types = factory.getSupportedTypes();
                             if (types != null) {
-                                for (String type : types) {
+                                for (final String type : types) {
                                     if (type.equals("*") || config.endsWith(type)) {
-                                        Configuration c = factory.getConfiguration(source);
+                                        final Configuration c = factory.getConfiguration(source);
                                         if (c != null) {
                                             return c;
                                         }
@@ -343,12 +343,12 @@ public abstract class ConfigurationFacto
                     }
                 }
             } else {
-                for (ConfigurationFactory factory : factories) {
-                    String[] types = factory.getSupportedTypes();
+                for (final ConfigurationFactory factory : factories) {
+                    final String[] types = factory.getSupportedTypes();
                     if (types != null) {
-                        for (String type : types) {
+                        for (final String type : types) {
                             if (type.equals("*") || configLocation.getPath().endsWith(type)) {
-                                Configuration config = factory.getConfiguration(name, configLocation);
+                                final Configuration config = factory.getConfiguration(name, configLocation);
                                 if (config != null) {
                                     return config;
                                 }
@@ -371,24 +371,24 @@ public abstract class ConfigurationFacto
             return config != null ? config : new DefaultConfiguration();
         }
 
-        private Configuration getConfiguration(boolean isTest, String name) {
-            boolean named = (name != null && name.length() > 0);
-            ClassLoader loader = this.getClass().getClassLoader();
-            for (ConfigurationFactory factory : factories) {
+        private Configuration getConfiguration(final boolean isTest, final String name) {
+            final boolean named = (name != null && name.length() > 0);
+            final ClassLoader loader = this.getClass().getClassLoader();
+            for (final ConfigurationFactory factory : factories) {
                 String configName;
-                String prefix = isTest ? TEST_PREFIX : DEFAULT_PREFIX;
-                String [] types = factory.getSupportedTypes();
+                final String prefix = isTest ? TEST_PREFIX : DEFAULT_PREFIX;
+                final String [] types = factory.getSupportedTypes();
                 if (types == null) {
                     continue;
                 }
 
-                for (String suffix : types) {
+                for (final String suffix : types) {
                     if (suffix.equals("*")) {
                         continue;
                     }
                     configName = named ? prefix + name + suffix : prefix + suffix;
 
-                    ConfigurationSource source = getInputFromResource(configName, loader);
+                    final ConfigurationSource source = getInputFromResource(configName, loader);
                     if (source != null) {
                         return factory.getConfiguration(source);
                     }
@@ -403,15 +403,15 @@ public abstract class ConfigurationFacto
         }
 
         @Override
-        public Configuration getConfiguration(ConfigurationSource source) {
+        public Configuration getConfiguration(final ConfigurationSource source) {
             if (source != null) {
-                String config = source.getLocation();
-                for (ConfigurationFactory factory : factories) {
-                    String[] types = factory.getSupportedTypes();
+                final String config = source.getLocation();
+                for (final ConfigurationFactory factory : factories) {
+                    final String[] types = factory.getSupportedTypes();
                     if (types != null) {
-                        for (String type : types) {
+                        for (final String type : types) {
                             if (type.equals("*") || (config != null && config.endsWith(type))) {
-                                Configuration c = factory.getConfiguration(source);
+                                final Configuration c = factory.getConfiguration(source);
                                 if (c != null) {
                                     return c;
                                 } else {
@@ -439,19 +439,19 @@ public abstract class ConfigurationFacto
         public ConfigurationSource() {
         }
 
-        public ConfigurationSource(InputStream stream) {
+        public ConfigurationSource(final InputStream stream) {
             this.stream = stream;
             this .file = null;
             this.location = null;
         }
 
-        public ConfigurationSource(InputStream stream, File file) {
+        public ConfigurationSource(final InputStream stream, final File file) {
             this.stream = stream;
             this.file = file;
             this.location = file.getAbsolutePath();
         }
 
-        public ConfigurationSource(InputStream stream, String location) {
+        public ConfigurationSource(final InputStream stream, final String location) {
             this.stream = stream;
             this.location = location;
             this.file = null;
@@ -461,7 +461,7 @@ public abstract class ConfigurationFacto
             return file;
         }
 
-        public void setFile(File file) {
+        public void setFile(final File file) {
             this.file = file;
         }
 
@@ -469,7 +469,7 @@ public abstract class ConfigurationFacto
             return location;
         }
 
-        public void setLocation(String location) {
+        public void setLocation(final String location) {
             this.location = location;
         }
 
@@ -477,7 +477,7 @@ public abstract class ConfigurationFacto
             return stream;
         }
 
-        public void setInputStream(InputStream stream) {
+        public void setInputStream(final InputStream stream) {
             this.stream = stream;
         }
     }

Modified: logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/config/Configurator.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/config/Configurator.java?rev=1419697&r1=1419696&r2=1419697&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/config/Configurator.java (original)
+++ logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/config/Configurator.java Mon Dec 10 19:36:06 2012
@@ -36,12 +36,12 @@ public final class Configurator {
      * @param configLocation The configuration for the logging context.
      * @return The LoggerContext.
      */
-    public static LoggerContext initialize(String name, ClassLoader loader, String configLocation) {
+    public static LoggerContext initialize(final String name, final ClassLoader loader, final String configLocation) {
 
         try {
-            URI uri = configLocation == null ? null : new URI(configLocation);
+            final URI uri = configLocation == null ? null : new URI(configLocation);
             return initialize(name, loader, uri);
-        } catch (URISyntaxException ex) {
+        } catch (final URISyntaxException ex) {
             ex.printStackTrace();
         }
         return null;
@@ -54,14 +54,14 @@ public final class Configurator {
      * @param configLocation The configuration for the logging context.
      * @return The LoggerContext.
      */
-    public static LoggerContext initialize(String name, ClassLoader loader, URI configLocation) {
+    public static LoggerContext initialize(final String name, final ClassLoader loader, final URI configLocation) {
 
         try {
-            LoggerContext ctx = (LoggerContext) LogManager.getContext(loader, false);
-            Configuration config = ConfigurationFactory.getInstance().getConfiguration(name, configLocation);
+            final LoggerContext ctx = (LoggerContext) LogManager.getContext(loader, false);
+            final Configuration config = ConfigurationFactory.getInstance().getConfiguration(name, configLocation);
             ctx.setConfiguration(config);
             return ctx;
-        } catch (Exception ex) {
+        } catch (final Exception ex) {
             ex.printStackTrace();
         }
         return null;
@@ -73,14 +73,14 @@ public final class Configurator {
      * @param source The InputSource for the configuration.
      * @return The LoggerContext.
      */
-    public static LoggerContext initialize(ClassLoader loader, ConfigurationFactory.ConfigurationSource source) {
+    public static LoggerContext initialize(final ClassLoader loader, final ConfigurationFactory.ConfigurationSource source) {
 
         try {
-            LoggerContext ctx = (LoggerContext) LogManager.getContext(loader, false);
-            Configuration config = ConfigurationFactory.getInstance().getConfiguration(source);
+            final LoggerContext ctx = (LoggerContext) LogManager.getContext(loader, false);
+            final Configuration config = ConfigurationFactory.getInstance().getConfiguration(source);
             ctx.setConfiguration(config);
             return ctx;
-        } catch (Exception ex) {
+        } catch (final Exception ex) {
             ex.printStackTrace();
         }
         return null;
@@ -90,7 +90,7 @@ public final class Configurator {
      * Shuts down the given logging context.
      * @param ctx the logging context to shut down, may be null.
      */
-    public static void shutdown(LoggerContext ctx) {
+    public static void shutdown(final LoggerContext ctx) {
         if (ctx != null) {
             ctx.setConfiguration(new DefaultConfiguration());
         }

Modified: logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/config/DefaultConfiguration.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/config/DefaultConfiguration.java?rev=1419697&r1=1419696&r2=1419697&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/config/DefaultConfiguration.java (original)
+++ logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/config/DefaultConfiguration.java Mon Dec 10 19:36:06 2012
@@ -44,16 +44,16 @@ public class DefaultConfiguration extend
     public DefaultConfiguration() {
 
         setName(DEFAULT_NAME);
-        Layout layout = PatternLayout.createLayout("%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n",
+        final Layout layout = PatternLayout.createLayout("%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n",
             null, null, null);
-        Appender appender = ConsoleAppender.createAppender(layout, null, "SYSTEM_OUT", "Console", "false", "true");
+        final Appender appender = ConsoleAppender.createAppender(layout, null, "SYSTEM_OUT", "Console", "false", "true");
         appender.start();
         addAppender(appender);
-        LoggerConfig root = getRootLogger();
+        final LoggerConfig root = getRootLogger();
         root.addAppender(appender, null, null);
 
-        String levelName = System.getProperty(DEFAULT_LEVEL);
-        Level level = levelName != null && Level.valueOf(levelName) != null ? Level.valueOf(levelName) : Level.ERROR;
+        final String levelName = System.getProperty(DEFAULT_LEVEL);
+        final Level level = levelName != null && Level.valueOf(levelName) != null ? Level.valueOf(levelName) : Level.ERROR;
         root.setLevel(level);
     }
 

Modified: logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/config/FileConfigurationMonitor.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/config/FileConfigurationMonitor.java?rev=1419697&r1=1419696&r2=1419697&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/config/FileConfigurationMonitor.java (original)
+++ logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/config/FileConfigurationMonitor.java Mon Dec 10 19:36:06 2012
@@ -43,7 +43,7 @@ public class FileConfigurationMonitor im
 
     private volatile int counter = 0;
 
-    private Reconfigurable reconfigurable;
+    private final Reconfigurable reconfigurable;
 
     /**
      * Constructor.
@@ -52,8 +52,8 @@ public class FileConfigurationMonitor im
      * @param listeners The List of ConfigurationListeners to notify upon a change.
      * @param interval The monitor interval in seconds. The minimum interval is 5 seconds.
      */
-    public FileConfigurationMonitor(Reconfigurable reconfigurable, File file, List<ConfigurationListener> listeners,
-                                    int interval) {
+    public FileConfigurationMonitor(final Reconfigurable reconfigurable, final File file, final List<ConfigurationListener> listeners,
+                                    final int interval) {
         this.reconfigurable = reconfigurable;
         this.file = file;
         this.lastModified = file.lastModified();
@@ -68,12 +68,12 @@ public class FileConfigurationMonitor im
     public void checkConfiguration() {
         if ((++counter & MASK) == 0) {
             synchronized (this) {
-                long current = System.currentTimeMillis();
+                final long current = System.currentTimeMillis();
                 if (current >= nextCheck) {
                     nextCheck = current + interval;
                     if (file.lastModified() > lastModified) {
                         lastModified = file.lastModified();
-                        for (ConfigurationListener listener : listeners) {
+                        for (final ConfigurationListener listener : listeners) {
                             listener.onChange(reconfigurable);
                         }
                     }

Modified: logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/config/JSONConfiguration.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/config/JSONConfiguration.java?rev=1419697&r1=1419696&r2=1419697&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/config/JSONConfiguration.java (original)
+++ logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/config/JSONConfiguration.java Mon Dec 10 19:36:06 2012
@@ -54,34 +54,34 @@ public class JSONConfiguration extends B
 
     private static final int BUF_SIZE = 16384;
 
-    private List<Status> status = new ArrayList<Status>();
+    private final List<Status> status = new ArrayList<Status>();
 
     private JsonNode root;
 
-    private List<String> messages = new ArrayList<String>();
+    private final List<String> messages = new ArrayList<String>();
 
-    private File configFile;
+    private final File configFile;
 
-    public JSONConfiguration(ConfigurationFactory.ConfigurationSource configSource) {
+    public JSONConfiguration(final ConfigurationFactory.ConfigurationSource configSource) {
         this.configFile = configSource.getFile();
         byte[] buffer;
 
         try {
-            InputStream configStream = configSource.getInputStream();
+            final InputStream configStream = configSource.getInputStream();
             buffer = toByteArray(configStream);
             configStream.close();
-            InputStream is = new ByteArrayInputStream(buffer);
-            ObjectMapper mapper = new ObjectMapper().configure(JsonParser.Feature.ALLOW_COMMENTS, true);
+            final InputStream is = new ByteArrayInputStream(buffer);
+            final ObjectMapper mapper = new ObjectMapper().configure(JsonParser.Feature.ALLOW_COMMENTS, true);
             root = mapper.readTree(is);
             if (root.size() == 1) {
-                Iterator<JsonNode> i = root.getElements();
+                final Iterator<JsonNode> i = root.getElements();
                 root = i.next();
             }
             processAttributes(rootNode, root);
             Level status = Level.OFF;
             boolean verbose = false;
             PrintStream stream = System.out;
-            for (Map.Entry<String, String> entry : rootNode.getAttributes().entrySet()) {
+            for (final Map.Entry<String, String> entry : rootNode.getAttributes().entrySet()) {
                 if ("status".equalsIgnoreCase(entry.getKey())) {
                     status = Level.toLevel(getSubst().replace(entry.getValue()), null);
                     if (status == null) {
@@ -89,15 +89,15 @@ public class JSONConfiguration extends B
                         messages.add("Invalid status specified: " + entry.getValue() + ". Defaulting to ERROR");
                     }
                 } else if ("dest".equalsIgnoreCase(entry.getKey())) {
-                    String dest = entry.getValue();
+                    final String dest = entry.getValue();
                     if (dest != null) {
                         if (dest.equalsIgnoreCase("err")) {
                             stream = System.err;
                         } else {
                             try {
-                                File destFile = FileUtils.fileFromURI(new URI(dest));
+                                final File destFile = FileUtils.fileFromURI(new URI(dest));
                                 stream = new PrintStream(new FileOutputStream(destFile));
-                            } catch (URISyntaxException use) {
+                            } catch (final URISyntaxException use) {
                                 System.err.println("Unable to write to " + dest + ". Writing to stdout");
                             }
                         }
@@ -105,24 +105,24 @@ public class JSONConfiguration extends B
                 } else if ("verbose".equalsIgnoreCase(entry.getKey())) {
                     verbose = Boolean.parseBoolean(getSubst().replace(entry.getValue()));
                 } else if ("packages".equalsIgnoreCase(entry.getKey())) {
-                    String[] packages = getSubst().replace(entry.getValue()).split(",");
-                    for (String p : packages) {
+                    final String[] packages = getSubst().replace(entry.getValue()).split(",");
+                    for (final String p : packages) {
                         PluginManager.addPackage(p);
                     }
                 } else if ("name".equalsIgnoreCase(entry.getKey())) {
                     setName(getSubst().replace(entry.getValue()));
                 } else if ("monitorInterval".equalsIgnoreCase(entry.getKey())) {
-                    int interval = Integer.parseInt(getSubst().replace(entry.getValue()));
+                    final int interval = Integer.parseInt(getSubst().replace(entry.getValue()));
                     if (interval > 0 && configFile != null) {
                         monitor = new FileConfigurationMonitor(this, configFile, listeners, interval);
                     }
                 }
             }
 
-            Iterator<StatusListener> statusIter = ((StatusLogger) LOGGER).getListeners();
+            final Iterator<StatusListener> statusIter = ((StatusLogger) LOGGER).getListeners();
             boolean found = false;
             while (statusIter.hasNext()) {
-                StatusListener listener = statusIter.next();
+                final StatusListener listener = statusIter.next();
                 if (listener instanceof StatusConsoleListener) {
                     found = true;
                     ((StatusConsoleListener) listener).setLevel(status);
@@ -132,19 +132,19 @@ public class JSONConfiguration extends B
                 }
             }
             if (!found && status != Level.OFF) {
-                StatusConsoleListener listener = new StatusConsoleListener(status, stream);
+                final StatusConsoleListener listener = new StatusConsoleListener(status, stream);
                 if (!verbose) {
                     listener.setFilters(VERBOSE_CLASSES);
                 }
                 ((StatusLogger) LOGGER).registerListener(listener);
-                for (String msg : messages) {
+                for (final String msg : messages) {
                     LOGGER.error(msg);
                 }
             }
             if (getName() == null) {
                 setName(configSource.getLocation());
             }
-        } catch (Exception ex) {
+        } catch (final Exception ex) {
             LOGGER.error("Error parsing " + configSource.getLocation(), ex);
             ex.printStackTrace();
         }
@@ -152,11 +152,11 @@ public class JSONConfiguration extends B
 
      @Override
     public void setup() {
-        Iterator<Map.Entry<String, JsonNode>> iter = root.getFields();
-        List<Node> children = rootNode.getChildren();
+        final Iterator<Map.Entry<String, JsonNode>> iter = root.getFields();
+        final List<Node> children = rootNode.getChildren();
         while (iter.hasNext()) {
-            Map.Entry<String, JsonNode> entry = iter.next();
-            JsonNode n = entry.getValue();
+            final Map.Entry<String, JsonNode> entry = iter.next();
+            final JsonNode n = entry.getValue();
             if (n.isObject()) {
                 LOGGER.debug("Processing node for object " + entry.getKey());
                 children.add(constructNode(entry.getKey(), rootNode, n));
@@ -166,7 +166,7 @@ public class JSONConfiguration extends B
         }
         LOGGER.debug("Completed parsing configuration");
         if (status.size() > 0) {
-            for (Status s : status) {
+            for (final Status s : status) {
                 LOGGER.error("Error processing element " + s.name + ": " + s.errorType);
             }
             return;
@@ -176,25 +176,25 @@ public class JSONConfiguration extends B
     public Configuration reconfigure() {
         if (configFile != null) {
             try {
-                ConfigurationFactory.ConfigurationSource source =
+                final ConfigurationFactory.ConfigurationSource source =
                     new ConfigurationFactory.ConfigurationSource(new FileInputStream(configFile), configFile);
                 return new JSONConfiguration(source);
-            } catch (FileNotFoundException ex) {
+            } catch (final FileNotFoundException ex) {
                 LOGGER.error("Cannot locate file " + configFile, ex);
             }
         }
         return null;
     }
 
-    private Node constructNode(String name, Node parent, JsonNode jsonNode) {
-        PluginType type = getPluginManager().getPluginType(name);
-        Node node = new Node(parent, name, type);
+    private Node constructNode(final String name, final Node parent, final JsonNode jsonNode) {
+        final PluginType type = getPluginManager().getPluginType(name);
+        final Node node = new Node(parent, name, type);
         processAttributes(node, jsonNode);
-        Iterator<Map.Entry<String, JsonNode>> iter = jsonNode.getFields();
-        List<Node> children = node.getChildren();
+        final Iterator<Map.Entry<String, JsonNode>> iter = jsonNode.getFields();
+        final List<Node> children = node.getChildren();
         while (iter.hasNext()) {
-            Map.Entry<String, JsonNode> entry = iter.next();
-            JsonNode n = entry.getValue();
+            final Map.Entry<String, JsonNode> entry = iter.next();
+            final JsonNode n = entry.getValue();
             if (n.isArray() || n.isObject()) {
                 if (type == null) {
                     status.add(new Status(name, n, ErrorType.CLASS_NOT_FOUND));
@@ -202,19 +202,19 @@ public class JSONConfiguration extends B
                 if (n.isArray()) {
                     LOGGER.debug("Processing node for array " + entry.getKey());
                     for (int i = 0; i < n.size(); ++i) {
-                        String pluginType = getType(n.get(i), entry.getKey());
-                        PluginType entryType = getPluginManager().getPluginType(pluginType);
-                        Node item = new Node(node, entry.getKey(), entryType);
+                        final String pluginType = getType(n.get(i), entry.getKey());
+                        final PluginType entryType = getPluginManager().getPluginType(pluginType);
+                        final Node item = new Node(node, entry.getKey(), entryType);
                         processAttributes(item, n.get(i));
                         if (pluginType.equals(entry.getKey())) {
                             LOGGER.debug("Processing " + entry.getKey() + "[" + i + "]");
                         } else {
                             LOGGER.debug("Processing " + pluginType + " " + entry.getKey() + "[" + i + "]");
                         }
-                        Iterator<Map.Entry<String, JsonNode>> itemIter = n.get(i).getFields();
-                        List<Node> itemChildren = item.getChildren();
+                        final Iterator<Map.Entry<String, JsonNode>> itemIter = n.get(i).getFields();
+                        final List<Node> itemChildren = item.getChildren();
                         while (itemIter.hasNext()) {
-                            Map.Entry<String, JsonNode> itemEntry = itemIter.next();
+                            final Map.Entry<String, JsonNode> itemEntry = itemIter.next();
                             if (itemEntry.getValue().isObject()) {
                                 LOGGER.debug("Processing node for object " + itemEntry.getKey());
                                 itemChildren.add(constructNode(itemEntry.getKey(), item, itemEntry.getValue()));
@@ -236,18 +236,18 @@ public class JSONConfiguration extends B
             t = type.getElementName() + ":" + type.getPluginClass();
         }
 
-        String p = node.getParent() == null ? "null" : node.getParent().getName() == null ?
+        final String p = node.getParent() == null ? "null" : node.getParent().getName() == null ?
             "root" : node.getParent().getName();
         LOGGER.debug("Returning " + node.getName() + " with parent " + p + " of type " +  t);
         return node;
     }
 
-    private String getType(JsonNode node, String name) {
-        Iterator<Map.Entry<String, JsonNode>> iter = node.getFields();
+    private String getType(final JsonNode node, final String name) {
+        final Iterator<Map.Entry<String, JsonNode>> iter = node.getFields();
         while (iter.hasNext()) {
-            Map.Entry<String, JsonNode> entry = iter.next();
+            final Map.Entry<String, JsonNode> entry = iter.next();
             if (entry.getKey().equalsIgnoreCase("type")) {
-                JsonNode n = entry.getValue();
+                final JsonNode n = entry.getValue();
                 if (n.isValueNode()) {
                     return n.asText();
                 }
@@ -256,13 +256,13 @@ public class JSONConfiguration extends B
         return name;
     }
 
-    private void processAttributes(Node parent, JsonNode node) {
-        Map<String, String> attrs = parent.getAttributes();
-        Iterator<Map.Entry<String, JsonNode>> iter = node.getFields();
+    private void processAttributes(final Node parent, final JsonNode node) {
+        final Map<String, String> attrs = parent.getAttributes();
+        final Iterator<Map.Entry<String, JsonNode>> iter = node.getFields();
         while (iter.hasNext()) {
-            Map.Entry<String, JsonNode> entry = iter.next();
+            final Map.Entry<String, JsonNode> entry = iter.next();
             if (!entry.getKey().equalsIgnoreCase("type")) {
-                JsonNode n = entry.getValue();
+                final JsonNode n = entry.getValue();
                 if (n.isValueNode()) {
                     attrs.put(entry.getKey(), n.asText());
                 }
@@ -270,11 +270,11 @@ public class JSONConfiguration extends B
         }
     }
 
-    protected byte[] toByteArray(InputStream is) throws IOException {
-        ByteArrayOutputStream buffer = new ByteArrayOutputStream();
+    protected byte[] toByteArray(final InputStream is) throws IOException {
+        final ByteArrayOutputStream buffer = new ByteArrayOutputStream();
 
         int nRead;
-        byte[] data = new byte[BUF_SIZE];
+        final byte[] data = new byte[BUF_SIZE];
 
         while ((nRead = is.read(data, 0, data.length)) != -1) {
             buffer.write(data, 0, nRead);
@@ -294,11 +294,11 @@ public class JSONConfiguration extends B
      * Status for recording errors.
      */
     private class Status {
-        private JsonNode node;
-        private String name;
-        private ErrorType errorType;
+        private final JsonNode node;
+        private final String name;
+        private final ErrorType errorType;
 
-        public Status(String name, JsonNode node, ErrorType errorType) {
+        public Status(final String name, final JsonNode node, final ErrorType errorType) {
             this.name = name;
             this.node = node;
             this.errorType = errorType;

Modified: logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/config/JSONConfigurationFactory.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/config/JSONConfigurationFactory.java?rev=1419697&r1=1419696&r2=1419697&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/config/JSONConfigurationFactory.java (original)
+++ logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/config/JSONConfigurationFactory.java Mon Dec 10 19:36:06 2012
@@ -36,16 +36,16 @@ public class JSONConfigurationFactory ex
         "org.codehaus.jackson.map.ObjectMapper"
     };
 
-    private File configFile = null;
+    private final File configFile = null;
 
     private boolean isActive;
 
     public JSONConfigurationFactory() {
         try {
-            for (String item : dependencies) {
+            for (final String item : dependencies) {
                 Class.forName(item);
             }
-        } catch (ClassNotFoundException ex) {
+        } catch (final ClassNotFoundException ex) {
             LOGGER.debug("Missing dependencies for Json support");
             isActive = false;
             return;
@@ -59,7 +59,7 @@ public class JSONConfigurationFactory ex
     }
 
     @Override
-    public Configuration getConfiguration(ConfigurationSource source) {
+    public Configuration getConfiguration(final ConfigurationSource source) {
         if (!isActive) {
             return null;
         }

Modified: logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/config/LoggerConfig.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/config/LoggerConfig.java?rev=1419697&r1=1419696&r2=1419697&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/config/LoggerConfig.java (original)
+++ logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/config/LoggerConfig.java Mon Dec 10 19:36:06 2012
@@ -57,13 +57,13 @@ public class LoggerConfig extends Abstra
     private static final long WAIT_TIME = 1000;
 
     private List<AppenderRef> appenderRefs = new ArrayList<AppenderRef>();
-    private Map<String, AppenderControl> appenders = new ConcurrentHashMap<String, AppenderControl>();
+    private final Map<String, AppenderControl> appenders = new ConcurrentHashMap<String, AppenderControl>();
     private final String name;
     private LogEventFactory logEventFactory;
     private Level level;
     private boolean additive = true;
     private LoggerConfig parent;
-    private AtomicInteger counter = new AtomicInteger();
+    private final AtomicInteger counter = new AtomicInteger();
     private boolean shutdown = false;
     private final Map<Property, Boolean> properties;
     private final Configuration config;
@@ -86,7 +86,7 @@ public class LoggerConfig extends Abstra
      * @param level The Level.
      * @param additive true if the Logger is additive, false otherwise.
      */
-    public LoggerConfig(String name, Level level, boolean additive) {
+    public LoggerConfig(final String name, final Level level, final boolean additive) {
         this.logEventFactory = this;
         this.name = name;
         this.level = level;
@@ -95,8 +95,8 @@ public class LoggerConfig extends Abstra
         this.config = null;
     }
 
-    protected LoggerConfig(String name, List<AppenderRef> appenders, Filter filter, Level level,
-                           boolean additive, Property[] properties, Configuration config) {
+    protected LoggerConfig(final String name, final List<AppenderRef> appenders, final Filter filter, final Level level,
+                           final boolean additive, final Property[] properties, final Configuration config) {
         super(filter);
         this.logEventFactory = this;
         this.name = name;
@@ -106,8 +106,8 @@ public class LoggerConfig extends Abstra
         this.config = config;
         if (properties != null && properties.length > 0) {
             this.properties = new HashMap<Property, Boolean>(properties.length);
-            for (Property prop : properties) {
-                boolean interpolate = prop.getValue().contains("${");
+            for (final Property prop : properties) {
+                final boolean interpolate = prop.getValue().contains("${");
                 this.properties.put(prop, interpolate);
             }
         } else {
@@ -132,7 +132,7 @@ public class LoggerConfig extends Abstra
      * Sets the parent of this LoggerConfig.
      * @param parent the parent LoggerConfig.
      */
-    public void setParent(LoggerConfig parent) {
+    public void setParent(final LoggerConfig parent) {
         this.parent = parent;
     }
 
@@ -150,7 +150,7 @@ public class LoggerConfig extends Abstra
      * @param level The Level to use.
      * @param filter A Filter for the Appender reference.
      */
-    public void addAppender(Appender appender, Level level, Filter filter) {
+    public void addAppender(final Appender appender, final Level level, final Filter filter) {
         appenders.put(appender.getName(), new AppenderControl(appender, level, filter));
     }
 
@@ -158,8 +158,8 @@ public class LoggerConfig extends Abstra
      * Removes the Appender with the specific name.
      * @param name The name of the Appender.
      */
-    public void removeAppender(String name) {
-        AppenderControl ctl = appenders.remove(name);
+    public void removeAppender(final String name) {
+        final AppenderControl ctl = appenders.remove(name);
         if (ctl != null) {
             cleanupFilter(ctl);
         }
@@ -170,8 +170,8 @@ public class LoggerConfig extends Abstra
      * @return a Map with the Appender name as the key and the Appender as the value.
      */
     public Map<String, Appender> getAppenders() {
-        Map<String, Appender> map = new HashMap<String, Appender>();
-        for (Map.Entry<String, AppenderControl> entry : appenders.entrySet()) {
+        final Map<String, Appender> map = new HashMap<String, Appender>();
+        for (final Map.Entry<String, AppenderControl> entry : appenders.entrySet()) {
             map.put(entry.getKey(), entry.getValue().getAppender());
         }
         return map;
@@ -182,17 +182,17 @@ public class LoggerConfig extends Abstra
      */
     protected void clearAppenders() {
         waitForCompletion();
-        Collection<AppenderControl> controls = appenders.values();
-        Iterator<AppenderControl> iterator = controls.iterator();
+        final Collection<AppenderControl> controls = appenders.values();
+        final Iterator<AppenderControl> iterator = controls.iterator();
         while (iterator.hasNext()) {
-            AppenderControl ctl = iterator.next();
+            final AppenderControl ctl = iterator.next();
             iterator.remove();
             cleanupFilter(ctl);
         }
     }
 
-    private void cleanupFilter(AppenderControl ctl) {
-        Filter filter = ctl.getFilter();
+    private void cleanupFilter(final AppenderControl ctl) {
+        final Filter filter = ctl.getFilter();
         if (filter != null) {
             ctl.removeFilter(filter);
             if (filter instanceof LifeCycle) {
@@ -213,7 +213,7 @@ public class LoggerConfig extends Abstra
      * Sets the logging Level.
      * @param level The logging Level.
      */
-    public void setLevel(Level level) {
+    public void setLevel(final Level level) {
         this.level = level;
     }
 
@@ -237,7 +237,7 @@ public class LoggerConfig extends Abstra
      * Sets the LogEventFactory. Usually the LogEventFactory will be this LoggerConfig.
      * @param logEventFactory the LogEventFactory.
      */
-    public void setLogEventFactory(LogEventFactory logEventFactory) {
+    public void setLogEventFactory(final LogEventFactory logEventFactory) {
         this.logEventFactory = logEventFactory;
     }
 
@@ -253,7 +253,7 @@ public class LoggerConfig extends Abstra
      * Sets the additive setting.
      * @param additive true if thee LoggerConfig should be additive, false otherwise.
      */
-    public void setAdditive(boolean additive) {
+    public void setAdditive(final boolean additive) {
         this.additive = additive;
     }
 
@@ -266,18 +266,18 @@ public class LoggerConfig extends Abstra
      * @param data The Message.
      * @param t A Throwable or null.
      */
-    public void log(String loggerName, Marker marker, String fqcn, Level level, Message data, Throwable t) {
+    public void log(final String loggerName, final Marker marker, final String fqcn, final Level level, final Message data, final Throwable t) {
         List<Property> props = null;
         if (properties != null) {
             props = new ArrayList<Property>(properties.size());
 
-            for (Map.Entry<Property, Boolean> entry : properties.entrySet()) {
-                Property prop = entry.getKey();
-                String value = entry.getValue() ? config.getSubst().replace(prop.getValue()) : prop.getValue();
+            for (final Map.Entry<Property, Boolean> entry : properties.entrySet()) {
+                final Property prop = entry.getKey();
+                final String value = entry.getValue() ? config.getSubst().replace(prop.getValue()) : prop.getValue();
                 props.add(Property.createProperty(prop.getName(), value));
             }
         }
-        LogEvent event = logEventFactory.createEvent(loggerName, marker, fqcn, level, data, props, t);
+        final LogEvent event = logEventFactory.createEvent(loggerName, marker, fqcn, level, data, props, t);
         log(event);
     }
 
@@ -293,7 +293,7 @@ public class LoggerConfig extends Abstra
         while (counter.get() > 0) {
             try {
                 wait(WAIT_TIME * (retries + 1));
-            } catch (InterruptedException ie) {
+            } catch (final InterruptedException ie) {
                 if (++retries > MAX_RETRIES) {
                     break;
                 }
@@ -305,7 +305,7 @@ public class LoggerConfig extends Abstra
      * Logs an event.
      * @param event The log event.
      */
-    public void log(LogEvent event) {
+    public void log(final LogEvent event) {
 
         counter.incrementAndGet();
         try {
@@ -330,8 +330,8 @@ public class LoggerConfig extends Abstra
         }
     }
 
-    private void callAppenders(LogEvent event) {
-        for (AppenderControl control : appenders.values()) {
+    private void callAppenders(final LogEvent event) {
+        for (final AppenderControl control : appenders.values()) {
             control.callAppender(event);
         }
     }
@@ -346,8 +346,8 @@ public class LoggerConfig extends Abstra
      * @param t An optional Throwable.
      * @return The LogEvent.
      */
-    public LogEvent createEvent(String loggerName, Marker marker, String fqcn, Level level, Message data,
-                                List<Property> properties, Throwable t) {
+    public LogEvent createEvent(final String loggerName, final Marker marker, final String fqcn, final Level level, final Message data,
+                                final List<Property> properties, final Throwable t) {
         return new Log4jLogEvent(loggerName, marker, fqcn, level, data, properties, t);
     }
 
@@ -366,28 +366,28 @@ public class LoggerConfig extends Abstra
      * @return A new LoggerConfig.
      */
     @PluginFactory
-    public static LoggerConfig createLogger(@PluginAttr("additivity") String additivity,
-                                            @PluginAttr("level") String levelName,
-                                            @PluginAttr("name") String loggerName,
-                                            @PluginElement("appender-ref") AppenderRef[] refs,
-                                            @PluginElement("properties") Property[] properties,
-                                            @PluginConfiguration Configuration config,
-                                            @PluginElement("filters") Filter filter) {
+    public static LoggerConfig createLogger(@PluginAttr("additivity") final String additivity,
+                                            @PluginAttr("level") final String levelName,
+                                            @PluginAttr("name") final String loggerName,
+                                            @PluginElement("appender-ref") final AppenderRef[] refs,
+                                            @PluginElement("properties") final Property[] properties,
+                                            @PluginConfiguration final Configuration config,
+                                            @PluginElement("filters") final Filter filter) {
         if (loggerName == null) {
             LOGGER.error("Loggers cannot be configured without a name");
             return null;
         }
 
-        List<AppenderRef> appenderRefs = Arrays.asList(refs);
+        final List<AppenderRef> appenderRefs = Arrays.asList(refs);
         Level level;
         try {
             level = Level.toLevel(levelName, Level.ERROR);
-        } catch (Exception ex) {
+        } catch (final Exception ex) {
             LOGGER.error("Invalid Log level specified: {}. Defaulting to Error", levelName);
             level = Level.ERROR;
         }
-        String name = loggerName.equals("root") ? "" : loggerName;
-        boolean additive = additivity == null ? true : Boolean.parseBoolean(additivity);
+        final String name = loggerName.equals("root") ? "" : loggerName;
+        final boolean additive = additivity == null ? true : Boolean.parseBoolean(additivity);
 
         return new LoggerConfig(name, appenderRefs, filter, level, additive, properties, config);
     }
@@ -399,21 +399,21 @@ public class LoggerConfig extends Abstra
     public static class RootLogger extends LoggerConfig {
 
         @PluginFactory
-        public static LoggerConfig createLogger(@PluginAttr("additivity") String additivity,
-                                            @PluginAttr("level") String levelName,
-                                            @PluginElement("appender-ref") AppenderRef[] refs,
-                                            @PluginElement("properties") Property[] properties,
-                                            @PluginConfiguration Configuration config,
-                                            @PluginElement("filters") Filter filter) {
-            List<AppenderRef> appenderRefs = Arrays.asList(refs);
+        public static LoggerConfig createLogger(@PluginAttr("additivity") final String additivity,
+                                            @PluginAttr("level") final String levelName,
+                                            @PluginElement("appender-ref") final AppenderRef[] refs,
+                                            @PluginElement("properties") final Property[] properties,
+                                            @PluginConfiguration final Configuration config,
+                                            @PluginElement("filters") final Filter filter) {
+            final List<AppenderRef> appenderRefs = Arrays.asList(refs);
             Level level;
             try {
                 level = Level.toLevel(levelName, Level.ERROR);
-            } catch (Exception ex) {
+            } catch (final Exception ex) {
                 LOGGER.error("Invalid Log level specified: {}. Defaulting to Error", levelName);
                 level = Level.ERROR;
             }
-            boolean additive = additivity == null ? true : Boolean.parseBoolean(additivity);
+            final boolean additive = additivity == null ? true : Boolean.parseBoolean(additivity);
 
             return new LoggerConfig(LogManager.ROOT_LOGGER_NAME, appenderRefs, filter, level, additive, properties,
                 config);

Modified: logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/config/Loggers.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/config/Loggers.java?rev=1419697&r1=1419696&r2=1419697&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/config/Loggers.java (original)
+++ logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/config/Loggers.java Mon Dec 10 19:36:06 2012
@@ -25,7 +25,7 @@ public class Loggers {
     private final ConcurrentMap<String, LoggerConfig> map;
     private final LoggerConfig root;
 
-    public Loggers(ConcurrentMap<String, LoggerConfig> map, LoggerConfig root) {
+    public Loggers(final ConcurrentMap<String, LoggerConfig> map, final LoggerConfig root) {
         this.map = map;
         this.root = root;
     }

Modified: logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/config/Node.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/config/Node.java?rev=1419697&r1=1419696&r2=1419697&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/config/Node.java (original)
+++ logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/config/Node.java Mon Dec 10 19:36:06 2012
@@ -45,7 +45,7 @@ public class Node {
      * @param name the node's name.
      * @param type The Plugin Type associated with the node.
      */
-    public Node(Node parent, String name, PluginType type) {
+    public Node(final Node parent, final String name, final PluginType type) {
         this.parent = parent;
         this.name = name;
         this.type = type;
@@ -57,13 +57,13 @@ public class Node {
         this.type = null;
     }
 
-    public Node(Node node) {
+    public Node(final Node node) {
         this.parent = node.parent;
         this.name = node.name;
         this.type = node.type;
         this.attributes.putAll(node.getAttributes());
         this.value = node.getValue();
-        for (Node child : node.getChildren()) {
+        for (final Node child : node.getChildren()) {
             this.children.add(new Node(child));
         }
         this.object = node.object;
@@ -85,7 +85,7 @@ public class Node {
         return value;
     }
 
-    public void setValue(String value) {
+    public void setValue(final String value) {
         this.value = value;
     }
 
@@ -101,7 +101,7 @@ public class Node {
         return parent == null;
     }
 
-    public void setObject(Object obj) {
+    public void setObject(final Object obj) {
         object = obj;
     }
 



Mime
View raw message