Add final modifier to method parameters. Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/31ddd8f1 Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/31ddd8f1 Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/31ddd8f1
Branch: refs/heads/master Commit: 31ddd8f109ea0aa8e8fdd591151dc3d6bf7c8586 Parents: ba48417 Author: Gary Gregory <[email protected]> Authored: Sat Nov 12 01:11:40 2016 -0800 Committer: Gary Gregory <[email protected]> Committed: Sat Nov 12 01:11:40 2016 -0800 ---------------------------------------------------------------------- .../config/Log4j1ConfigurationConverter.java | 2 +- .../log4j/config/Log4j1ConfigurationParser.java | 6 +- .../logging/log4j/message/MapMessage.java | 2 +- .../CopyOnWriteSortedArrayThreadContextMap.java | 2 +- .../log4j/spi/DefaultThreadContextMap.java | 2 +- .../GarbageFreeSortedArrayThreadContextMap.java | 2 +- .../logging/log4j/util/PropertiesUtil.java | 620 +++++++++---------- .../logging/log4j/spi/LoggerAdapterTest.java | 6 +- .../logging/log4j/util/DeserializerHelper.java | 2 +- .../log4j/util/SortedArrayStringMapTest.java | 4 +- .../log4j/core/appender/AbstractAppender.java | 2 +- .../log4j/core/appender/ConsoleAppender.java | 2 +- .../log4j/core/appender/NullAppender.java | 2 +- .../core/appender/RandomAccessFileAppender.java | 10 +- .../config/builder/impl/BuiltConfiguration.java | 2 +- .../logging/log4j/core/layout/HtmlLayout.java | 4 +- .../log4j/core/layout/PatternLayout.java | 2 +- .../log4j/core/lookup/StrSubstitutor.java | 4 +- .../core/net/server/AbstractSocketServer.java | 2 +- .../log4j/core/net/server/TcpSocketServer.java | 4 +- .../net/ssl/AbstractKeyStoreConfiguration.java | 2 +- .../core/net/ssl/KeyStoreConfiguration.java | 2 +- .../log4j/core/net/ssl/SslConfiguration.java | 2 +- .../core/net/ssl/TrustStoreConfiguration.java | 2 +- .../EqualsIgnoreCaseReplacementConverter.java | 2 +- .../pattern/EqualsReplacementConverter.java | 2 +- .../core/util/BasicCommandLineArguments.java | 2 +- .../log4j/core/util/InetAddressConverter.java | 2 +- .../org/apache/logging/slf4j/MDCContextMap.java | 2 +- .../log4j/web/appender/ServletAppender.java | 4 +- 30 files changed, 352 insertions(+), 352 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/31ddd8f1/log4j-1.2-api/src/main/java/org/apache/log4j/config/Log4j1ConfigurationConverter.java ---------------------------------------------------------------------- diff --git a/log4j-1.2-api/src/main/java/org/apache/log4j/config/Log4j1ConfigurationConverter.java b/log4j-1.2-api/src/main/java/org/apache/log4j/config/Log4j1ConfigurationConverter.java index 9e63a73..dcb1ecb 100644 --- a/log4j-1.2-api/src/main/java/org/apache/log4j/config/Log4j1ConfigurationConverter.java +++ b/log4j-1.2-api/src/main/java/org/apache/log4j/config/Log4j1ConfigurationConverter.java @@ -123,7 +123,7 @@ public final class Log4j1ConfigurationConverter { Log4j1ConfigurationConverter.class, new CommandLineArguments())).run(); } - public static Log4j1ConfigurationConverter run(CommandLineArguments cla) { + public static Log4j1ConfigurationConverter run(final CommandLineArguments cla) { final Log4j1ConfigurationConverter log4j1ConfigurationConverter = new Log4j1ConfigurationConverter(cla); log4j1ConfigurationConverter.run(); return log4j1ConfigurationConverter; http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/31ddd8f1/log4j-1.2-api/src/main/java/org/apache/log4j/config/Log4j1ConfigurationParser.java ---------------------------------------------------------------------- diff --git a/log4j-1.2-api/src/main/java/org/apache/log4j/config/Log4j1ConfigurationParser.java b/log4j-1.2-api/src/main/java/org/apache/log4j/config/Log4j1ConfigurationParser.java index 894f6e5..c453f61 100644 --- a/log4j-1.2-api/src/main/java/org/apache/log4j/config/Log4j1ConfigurationParser.java +++ b/log4j-1.2-api/src/main/java/org/apache/log4j/config/Log4j1ConfigurationParser.java @@ -134,7 +134,7 @@ public class Log4j1ConfigurationParser { } } - private void warn(String string) { + private void warn(final String string) { System.err.println(string); } @@ -280,7 +280,7 @@ public class Log4j1ConfigurationParser { } } - private void buildNullAppender(String appenderName) { + private void buildNullAppender(final String appenderName) { final AppenderComponentBuilder appenderBuilder = builder.newAppender(appenderName, NullAppender.PLUGIN_NAME); builder.add(appenderBuilder); } @@ -425,7 +425,7 @@ public class Log4j1ConfigurationParser { return strSubstitutorProperties.replace(sysValue); } - private String getProperty(final String key, String defaultValue) { + private String getProperty(final String key, final String defaultValue) { final String value = getProperty(key); return value == null ? defaultValue : value; } http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/31ddd8f1/log4j-api/src/main/java/org/apache/logging/log4j/message/MapMessage.java ---------------------------------------------------------------------- diff --git a/log4j-api/src/main/java/org/apache/logging/log4j/message/MapMessage.java b/log4j-api/src/main/java/org/apache/logging/log4j/message/MapMessage.java index 0ec8280..0425de9 100644 --- a/log4j-api/src/main/java/org/apache/logging/log4j/message/MapMessage.java +++ b/log4j-api/src/main/java/org/apache/logging/log4j/message/MapMessage.java @@ -109,7 +109,7 @@ public class MapMessage implements MultiformatMessage { * @param key the key whose value to look up in the message data * @return the value of the specified key in the message data, or {@code null} */ - public String getDataValue(String key) { + public String getDataValue(final String key) { return data.get(key); } http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/31ddd8f1/log4j-api/src/main/java/org/apache/logging/log4j/spi/CopyOnWriteSortedArrayThreadContextMap.java ---------------------------------------------------------------------- diff --git a/log4j-api/src/main/java/org/apache/logging/log4j/spi/CopyOnWriteSortedArrayThreadContextMap.java b/log4j-api/src/main/java/org/apache/logging/log4j/spi/CopyOnWriteSortedArrayThreadContextMap.java index 7b70e55..3b06686 100644 --- a/log4j-api/src/main/java/org/apache/logging/log4j/spi/CopyOnWriteSortedArrayThreadContextMap.java +++ b/log4j-api/src/main/java/org/apache/logging/log4j/spi/CopyOnWriteSortedArrayThreadContextMap.java @@ -156,7 +156,7 @@ class CopyOnWriteSortedArrayThreadContextMap implements ReadOnlyThreadContextMap } @Override - public void removeAll(Iterable<String> keys) { + public void removeAll(final Iterable<String> keys) { final StringMap map = localMap.get(); if (map != null) { final StringMap copy = createStringMap(map); http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/31ddd8f1/log4j-api/src/main/java/org/apache/logging/log4j/spi/DefaultThreadContextMap.java ---------------------------------------------------------------------- diff --git a/log4j-api/src/main/java/org/apache/logging/log4j/spi/DefaultThreadContextMap.java b/log4j-api/src/main/java/org/apache/logging/log4j/spi/DefaultThreadContextMap.java index fbf21d9..3513074 100644 --- a/log4j-api/src/main/java/org/apache/logging/log4j/spi/DefaultThreadContextMap.java +++ b/log4j-api/src/main/java/org/apache/logging/log4j/spi/DefaultThreadContextMap.java @@ -109,7 +109,7 @@ public class DefaultThreadContextMap implements ThreadContextMap, ReadOnlyString } } - public void removeAll(Iterable<String> keys) { + public void removeAll(final Iterable<String> keys) { final Map<String, String> map = localMap.get(); if (map != null) { final Map<String, String> copy = new HashMap<>(map); http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/31ddd8f1/log4j-api/src/main/java/org/apache/logging/log4j/spi/GarbageFreeSortedArrayThreadContextMap.java ---------------------------------------------------------------------- diff --git a/log4j-api/src/main/java/org/apache/logging/log4j/spi/GarbageFreeSortedArrayThreadContextMap.java b/log4j-api/src/main/java/org/apache/logging/log4j/spi/GarbageFreeSortedArrayThreadContextMap.java index 3eadb2c..d8be3c9 100644 --- a/log4j-api/src/main/java/org/apache/logging/log4j/spi/GarbageFreeSortedArrayThreadContextMap.java +++ b/log4j-api/src/main/java/org/apache/logging/log4j/spi/GarbageFreeSortedArrayThreadContextMap.java @@ -150,7 +150,7 @@ class GarbageFreeSortedArrayThreadContextMap implements ReadOnlyThreadContextMap } @Override - public void removeAll(Iterable<String> keys) { + public void removeAll(final Iterable<String> keys) { final StringMap map = localMap.get(); if (map != null) { for (final String key : keys) { http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/31ddd8f1/log4j-api/src/main/java/org/apache/logging/log4j/util/PropertiesUtil.java ---------------------------------------------------------------------- diff --git a/log4j-api/src/main/java/org/apache/logging/log4j/util/PropertiesUtil.java b/log4j-api/src/main/java/org/apache/logging/log4j/util/PropertiesUtil.java index af0b29e..0fbd1c1 100644 --- a/log4j-api/src/main/java/org/apache/logging/log4j/util/PropertiesUtil.java +++ b/log4j-api/src/main/java/org/apache/logging/log4j/util/PropertiesUtil.java @@ -1,310 +1,310 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache license, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the license for the specific language governing permissions and - * limitations under the license. - */ -package org.apache.logging.log4j.util; - -import java.io.IOException; -import java.io.InputStream; -import java.net.URL; -import java.nio.charset.Charset; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Properties; -import java.util.concurrent.ConcurrentHashMap; - -/** - * <em>Consider this class private.</em> - * <p> - * Helps access properties. This utility provides a method to override system properties by specifying properties in a - * properties file. - * </p> - */ -public final class PropertiesUtil { - - private static final PropertiesUtil LOG4J_PROPERTIES = new PropertiesUtil("log4j2.component.properties"); - - private final Properties props; - - /** - * Constructs a PropertiesUtil using a given Properties object as its source of defined properties. - * - * @param props the Properties to use by default - */ - public PropertiesUtil(final Properties props) { - this.props = props; - } - - /** - * Constructs a PropertiesUtil for a given properties file name on the classpath. The properties specified in this - * file are used by default. If a property is not defined in this file, then the equivalent system property is used. - * - * @param propertiesFileName the location of properties file to load - */ - public PropertiesUtil(final String propertiesFileName) { - final Properties properties = new Properties(); - for (final URL url : LoaderUtil.findResources(propertiesFileName)) { - try (final InputStream in = url.openStream()) { - properties.load(in); - } catch (final IOException ioe) { - LowLevelLogUtil.logException("Unable to read " + url.toString(), ioe); - } - } - this.props = properties; - } - - /** - * Loads and closes the given property input stream. If an error occurs, log to the status logger. - * - * @param in a property input stream. - * @param source a source object describing the source, like a resource string or a URL. - * @return a new Properties object - */ - static Properties loadClose(final InputStream in, final Object source) { - final Properties props = new Properties(); - if (null != in) { - try { - props.load(in); - } catch (final IOException e) { - LowLevelLogUtil.logException("Unable to read " + source, e); - } finally { - try { - in.close(); - } catch (final IOException e) { - LowLevelLogUtil.logException("Unable to close " + source, e); - } - } - } - return props; - } - - /** - * Returns the PropertiesUtil used by Log4j. - * - * @return the main Log4j PropertiesUtil instance. - */ - public static PropertiesUtil getProperties() { - return LOG4J_PROPERTIES; - } - - /** - * Gets the named property as a boolean value. If the property matches the string {@code "true"} (case-insensitive), - * then it is returned as the boolean value {@code true}. Any other non-{@code null} text in the property is - * considered {@code false}. - * - * @param name the name of the property to look up - * @return the boolean value of the property or {@code false} if undefined. - */ - public boolean getBooleanProperty(final String name) { - return getBooleanProperty(name, false); - } - - /** - * Gets the named property as a boolean value. - * - * @param name the name of the property to look up - * @param defaultValue the default value to use if the property is undefined - * @return the boolean value of the property or {@code defaultValue} if undefined. - */ - public boolean getBooleanProperty(final String name, final boolean defaultValue) { - final String prop = getStringProperty(name); - return (prop == null) ? defaultValue : "true".equalsIgnoreCase(prop); - } - - /** - * Gets the named property as a Charset value. - * - * @param name the name of the property to look up - * @return the Charset value of the property or {@link Charset#defaultCharset()} if undefined. - */ - public Charset getCharsetProperty(final String name) { - return getCharsetProperty(name, Charset.defaultCharset()); - } - - /** - * Gets the named property as a Charset value. - * - * @param name the name of the property to look up - * @param defaultValue the default value to use if the property is undefined - * @return the Charset value of the property or {@code defaultValue} if undefined. - */ - public Charset getCharsetProperty(String name, Charset defaultValue) { - final String prop = getStringProperty(name); - return prop == null ? defaultValue : Charset.forName(name); - } - - /** - * Gets the named property as a double. - * - * @param name the name of the property to look up - * @param defaultValue the default value to use if the property is undefined - * @return the parsed double value of the property or {@code defaultValue} if it was undefined or could not be parsed. - */ - public double getDoubleProperty(final String name, final double defaultValue) { - final String prop = getStringProperty(name); - if (prop != null) { - try { - return Double.parseDouble(prop); - } catch (final Exception ignored) { - return defaultValue; - } - } - return defaultValue; - } - - /** - * Gets the named property as an integer. - * - * @param name the name of the property to look up - * @param defaultValue the default value to use if the property is undefined - * @return the parsed integer value of the property or {@code defaultValue} if it was undefined or could not be - * parsed. - */ - public int getIntegerProperty(final String name, final int defaultValue) { - final String prop = getStringProperty(name); - if (prop != null) { - try { - return Integer.parseInt(prop); - } catch (final Exception ignored) { - return defaultValue; - } - } - return defaultValue; - } - - /** - * Gets the named property as a long. - * - * @param name the name of the property to look up - * @param defaultValue the default value to use if the property is undefined - * @return the parsed long value of the property or {@code defaultValue} if it was undefined or could not be parsed. - */ - public long getLongProperty(final String name, final long defaultValue) { - final String prop = getStringProperty(name); - if (prop != null) { - try { - return Long.parseLong(prop); - } catch (final Exception ignored) { - return defaultValue; - } - } - return defaultValue; - } - - /** - * Gets the named property as a String. - * - * @param name the name of the property to look up - * @return the String value of the property or {@code null} if undefined. - */ - public String getStringProperty(final String name) { - String prop = null; - try { - prop = System.getProperty(name); - } catch (final SecurityException ignored) { - // Ignore - } - return prop == null ? props.getProperty(name) : prop; - } - - /** - * Gets the named property as a String. - * - * @param name the name of the property to look up - * @param defaultValue the default value to use if the property is undefined - * @return the String value of the property or {@code defaultValue} if undefined. - */ - public String getStringProperty(final String name, final String defaultValue) { - final String prop = getStringProperty(name); - return (prop == null) ? defaultValue : prop; - } - - /** - * Return the system properties or an empty Properties object if an error occurs. - * - * @return The system properties. - */ - public static Properties getSystemProperties() { - try { - return new Properties(System.getProperties()); - } catch (final SecurityException ex) { - LowLevelLogUtil.logException("Unable to access system properties.", ex); - // Sandboxed - can't read System Properties - return new Properties(); - } - } - - /** - * Extracts properties that start with or are equals to the specific prefix and returns them in a new Properties - * object with the prefix removed. - * - * @param properties The Properties to evaluate. - * @param prefix The prefix to extract. - * @return The subset of properties. - */ - public static Properties extractSubset(final Properties properties, final String prefix) { - final Properties subset = new Properties(); - - if (prefix == null || prefix.length() == 0) { - return subset; - } - - final String prefixToMatch = prefix.charAt(prefix.length() - 1) != '.' ? prefix + '.' : prefix; - - final List<String> keys = new ArrayList<>(); - - for (final String key : properties.stringPropertyNames()) { - if (key.startsWith(prefixToMatch)) { - subset.setProperty(key.substring(prefixToMatch.length()), properties.getProperty(key)); - keys.add(key); - } - } - for (final String key : keys) { - properties.remove(key); - } - - return subset; - } - - /** - * Partitions a properties map based on common key prefixes up to the first period. - * - * @param properties properties to partition - * @return the partitioned properties where each key is the common prefix (minus the period) and the values are - * new property maps without the prefix and period in the key - * @since 2.6 - */ - public static Map<String, Properties> partitionOnCommonPrefixes(final Properties properties) { - final Map<String, Properties> parts = new ConcurrentHashMap<>(); - for (final String key : properties.stringPropertyNames()) { - final String prefix = key.substring(0, key.indexOf('.')); - if (!parts.containsKey(prefix)) { - parts.put(prefix, new Properties()); - } - parts.get(prefix).setProperty(key.substring(key.indexOf('.') + 1), properties.getProperty(key)); - } - return parts; - } - - /** - * Returns true if system properties tell us we are running on Windows. - * @return true if system properties tell us we are running on Windows. - */ - public boolean isOsWindows() { - return getStringProperty("os.name").startsWith("Windows"); - } - -} +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache license, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the license for the specific language governing permissions and + * limitations under the license. + */ +package org.apache.logging.log4j.util; + +import java.io.IOException; +import java.io.InputStream; +import java.net.URL; +import java.nio.charset.Charset; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Properties; +import java.util.concurrent.ConcurrentHashMap; + +/** + * <em>Consider this class private.</em> + * <p> + * Helps access properties. This utility provides a method to override system properties by specifying properties in a + * properties file. + * </p> + */ +public final class PropertiesUtil { + + private static final PropertiesUtil LOG4J_PROPERTIES = new PropertiesUtil("log4j2.component.properties"); + + private final Properties props; + + /** + * Constructs a PropertiesUtil using a given Properties object as its source of defined properties. + * + * @param props the Properties to use by default + */ + public PropertiesUtil(final Properties props) { + this.props = props; + } + + /** + * Constructs a PropertiesUtil for a given properties file name on the classpath. The properties specified in this + * file are used by default. If a property is not defined in this file, then the equivalent system property is used. + * + * @param propertiesFileName the location of properties file to load + */ + public PropertiesUtil(final String propertiesFileName) { + final Properties properties = new Properties(); + for (final URL url : LoaderUtil.findResources(propertiesFileName)) { + try (final InputStream in = url.openStream()) { + properties.load(in); + } catch (final IOException ioe) { + LowLevelLogUtil.logException("Unable to read " + url.toString(), ioe); + } + } + this.props = properties; + } + + /** + * Loads and closes the given property input stream. If an error occurs, log to the status logger. + * + * @param in a property input stream. + * @param source a source object describing the source, like a resource string or a URL. + * @return a new Properties object + */ + static Properties loadClose(final InputStream in, final Object source) { + final Properties props = new Properties(); + if (null != in) { + try { + props.load(in); + } catch (final IOException e) { + LowLevelLogUtil.logException("Unable to read " + source, e); + } finally { + try { + in.close(); + } catch (final IOException e) { + LowLevelLogUtil.logException("Unable to close " + source, e); + } + } + } + return props; + } + + /** + * Returns the PropertiesUtil used by Log4j. + * + * @return the main Log4j PropertiesUtil instance. + */ + public static PropertiesUtil getProperties() { + return LOG4J_PROPERTIES; + } + + /** + * Gets the named property as a boolean value. If the property matches the string {@code "true"} (case-insensitive), + * then it is returned as the boolean value {@code true}. Any other non-{@code null} text in the property is + * considered {@code false}. + * + * @param name the name of the property to look up + * @return the boolean value of the property or {@code false} if undefined. + */ + public boolean getBooleanProperty(final String name) { + return getBooleanProperty(name, false); + } + + /** + * Gets the named property as a boolean value. + * + * @param name the name of the property to look up + * @param defaultValue the default value to use if the property is undefined + * @return the boolean value of the property or {@code defaultValue} if undefined. + */ + public boolean getBooleanProperty(final String name, final boolean defaultValue) { + final String prop = getStringProperty(name); + return (prop == null) ? defaultValue : "true".equalsIgnoreCase(prop); + } + + /** + * Gets the named property as a Charset value. + * + * @param name the name of the property to look up + * @return the Charset value of the property or {@link Charset#defaultCharset()} if undefined. + */ + public Charset getCharsetProperty(final String name) { + return getCharsetProperty(name, Charset.defaultCharset()); + } + + /** + * Gets the named property as a Charset value. + * + * @param name the name of the property to look up + * @param defaultValue the default value to use if the property is undefined + * @return the Charset value of the property or {@code defaultValue} if undefined. + */ + public Charset getCharsetProperty(final String name, final Charset defaultValue) { + final String prop = getStringProperty(name); + return prop == null ? defaultValue : Charset.forName(name); + } + + /** + * Gets the named property as a double. + * + * @param name the name of the property to look up + * @param defaultValue the default value to use if the property is undefined + * @return the parsed double value of the property or {@code defaultValue} if it was undefined or could not be parsed. + */ + public double getDoubleProperty(final String name, final double defaultValue) { + final String prop = getStringProperty(name); + if (prop != null) { + try { + return Double.parseDouble(prop); + } catch (final Exception ignored) { + return defaultValue; + } + } + return defaultValue; + } + + /** + * Gets the named property as an integer. + * + * @param name the name of the property to look up + * @param defaultValue the default value to use if the property is undefined + * @return the parsed integer value of the property or {@code defaultValue} if it was undefined or could not be + * parsed. + */ + public int getIntegerProperty(final String name, final int defaultValue) { + final String prop = getStringProperty(name); + if (prop != null) { + try { + return Integer.parseInt(prop); + } catch (final Exception ignored) { + return defaultValue; + } + } + return defaultValue; + } + + /** + * Gets the named property as a long. + * + * @param name the name of the property to look up + * @param defaultValue the default value to use if the property is undefined + * @return the parsed long value of the property or {@code defaultValue} if it was undefined or could not be parsed. + */ + public long getLongProperty(final String name, final long defaultValue) { + final String prop = getStringProperty(name); + if (prop != null) { + try { + return Long.parseLong(prop); + } catch (final Exception ignored) { + return defaultValue; + } + } + return defaultValue; + } + + /** + * Gets the named property as a String. + * + * @param name the name of the property to look up + * @return the String value of the property or {@code null} if undefined. + */ + public String getStringProperty(final String name) { + String prop = null; + try { + prop = System.getProperty(name); + } catch (final SecurityException ignored) { + // Ignore + } + return prop == null ? props.getProperty(name) : prop; + } + + /** + * Gets the named property as a String. + * + * @param name the name of the property to look up + * @param defaultValue the default value to use if the property is undefined + * @return the String value of the property or {@code defaultValue} if undefined. + */ + public String getStringProperty(final String name, final String defaultValue) { + final String prop = getStringProperty(name); + return (prop == null) ? defaultValue : prop; + } + + /** + * Return the system properties or an empty Properties object if an error occurs. + * + * @return The system properties. + */ + public static Properties getSystemProperties() { + try { + return new Properties(System.getProperties()); + } catch (final SecurityException ex) { + LowLevelLogUtil.logException("Unable to access system properties.", ex); + // Sandboxed - can't read System Properties + return new Properties(); + } + } + + /** + * Extracts properties that start with or are equals to the specific prefix and returns them in a new Properties + * object with the prefix removed. + * + * @param properties The Properties to evaluate. + * @param prefix The prefix to extract. + * @return The subset of properties. + */ + public static Properties extractSubset(final Properties properties, final String prefix) { + final Properties subset = new Properties(); + + if (prefix == null || prefix.length() == 0) { + return subset; + } + + final String prefixToMatch = prefix.charAt(prefix.length() - 1) != '.' ? prefix + '.' : prefix; + + final List<String> keys = new ArrayList<>(); + + for (final String key : properties.stringPropertyNames()) { + if (key.startsWith(prefixToMatch)) { + subset.setProperty(key.substring(prefixToMatch.length()), properties.getProperty(key)); + keys.add(key); + } + } + for (final String key : keys) { + properties.remove(key); + } + + return subset; + } + + /** + * Partitions a properties map based on common key prefixes up to the first period. + * + * @param properties properties to partition + * @return the partitioned properties where each key is the common prefix (minus the period) and the values are + * new property maps without the prefix and period in the key + * @since 2.6 + */ + public static Map<String, Properties> partitionOnCommonPrefixes(final Properties properties) { + final Map<String, Properties> parts = new ConcurrentHashMap<>(); + for (final String key : properties.stringPropertyNames()) { + final String prefix = key.substring(0, key.indexOf('.')); + if (!parts.containsKey(prefix)) { + parts.put(prefix, new Properties()); + } + parts.get(prefix).setProperty(key.substring(key.indexOf('.') + 1), properties.getProperty(key)); + } + return parts; + } + + /** + * Returns true if system properties tell us we are running on Windows. + * @return true if system properties tell us we are running on Windows. + */ + public boolean isOsWindows() { + return getStringProperty("os.name").startsWith("Windows"); + } + +} http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/31ddd8f1/log4j-api/src/test/java/org/apache/logging/log4j/spi/LoggerAdapterTest.java ---------------------------------------------------------------------- diff --git a/log4j-api/src/test/java/org/apache/logging/log4j/spi/LoggerAdapterTest.java b/log4j-api/src/test/java/org/apache/logging/log4j/spi/LoggerAdapterTest.java index b00fea7..f53452c 100644 --- a/log4j-api/src/test/java/org/apache/logging/log4j/spi/LoggerAdapterTest.java +++ b/log4j-api/src/test/java/org/apache/logging/log4j/spi/LoggerAdapterTest.java @@ -40,8 +40,8 @@ public class LoggerAdapterTest { private final CountDownLatch startSignal; - public RunnableThreadTest(int index, TestLoggerAdapter adapter, LoggerContext context, - CountDownLatch startSignal, CountDownLatch doneSignal) { + public RunnableThreadTest(final int index, final TestLoggerAdapter adapter, final LoggerContext context, + final CountDownLatch startSignal, final CountDownLatch doneSignal) { this.adapter = adapter; this.context = context; this.startSignal = startSignal; @@ -82,7 +82,7 @@ public class LoggerAdapterTest { } @Override - protected Logger newLogger(String name, LoggerContext context) { + protected Logger newLogger(final String name, final LoggerContext context) { return null; } } http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/31ddd8f1/log4j-api/src/test/java/org/apache/logging/log4j/util/DeserializerHelper.java ---------------------------------------------------------------------- diff --git a/log4j-api/src/test/java/org/apache/logging/log4j/util/DeserializerHelper.java b/log4j-api/src/test/java/org/apache/logging/log4j/util/DeserializerHelper.java index 8fbc776..7e57027 100644 --- a/log4j-api/src/test/java/org/apache/logging/log4j/util/DeserializerHelper.java +++ b/log4j-api/src/test/java/org/apache/logging/log4j/util/DeserializerHelper.java @@ -26,7 +26,7 @@ import java.io.ObjectInputStream; * @see SortedArrayStringMapTest#testDeserializationOfUnknownClass() */ public class DeserializerHelper { - public static void main(String... args) throws Exception { + public static void main(final String... args) throws Exception { final File file = new File(args[0]); ObjectInputStream in = null; try { http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/31ddd8f1/log4j-api/src/test/java/org/apache/logging/log4j/util/SortedArrayStringMapTest.java ---------------------------------------------------------------------- diff --git a/log4j-api/src/test/java/org/apache/logging/log4j/util/SortedArrayStringMapTest.java b/log4j-api/src/test/java/org/apache/logging/log4j/util/SortedArrayStringMapTest.java index 0dc4478..244cc0a 100644 --- a/log4j-api/src/test/java/org/apache/logging/log4j/util/SortedArrayStringMapTest.java +++ b/log4j-api/src/test/java/org/apache/logging/log4j/util/SortedArrayStringMapTest.java @@ -127,7 +127,7 @@ public class SortedArrayStringMapTest { } } - private String createClassPath(Class<?>... classes) throws Exception { + private String createClassPath(final Class<?>... classes) throws Exception { final StringBuilder result = new StringBuilder(); for (final Class<?> cls : classes) { if (result.length() > 0) { @@ -138,7 +138,7 @@ public class SortedArrayStringMapTest { return result.toString(); } - private String createClassPath(Class<?> cls) throws Exception { + private String createClassPath(final Class<?> cls) throws Exception { final String resource = "/" + cls.getName().replace('.', '/') + ".class"; final URL url = cls.getResource(resource); String location = url.toString(); http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/31ddd8f1/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/AbstractAppender.java ---------------------------------------------------------------------- diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/AbstractAppender.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/AbstractAppender.java index 94f2fec..41c8545 100644 --- a/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/AbstractAppender.java +++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/AbstractAppender.java @@ -88,7 +88,7 @@ public abstract class AbstractAppender extends AbstractFilterable implements App return layout; } - public Layout<? extends Serializable> getOrCreateLayout(Charset charset) { + public Layout<? extends Serializable> getOrCreateLayout(final Charset charset) { if (layout == null) { return PatternLayout.newBuilder().withCharset(charset).build(); } http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/31ddd8f1/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/ConsoleAppender.java ---------------------------------------------------------------------- diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/ConsoleAppender.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/ConsoleAppender.java index 9479be8..ee98f7d 100644 --- a/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/ConsoleAppender.java +++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/ConsoleAppender.java @@ -81,7 +81,7 @@ public final class ConsoleAppender extends AbstractOutputStreamAppender<OutputSt public abstract Charset getDefaultCharset(); - protected Charset getCharset(String property) { + protected Charset getCharset(final String property) { return new PropertiesUtil(PropertiesUtil.getSystemProperties()).getCharsetProperty(property); } http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/31ddd8f1/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/NullAppender.java ---------------------------------------------------------------------- diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/NullAppender.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/NullAppender.java index 45cc47b..3978f05 100644 --- a/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/NullAppender.java +++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/NullAppender.java @@ -42,7 +42,7 @@ public class NullAppender extends AbstractAppender { } @Override - public void append(LogEvent event) { + public void append(final LogEvent event) { // Do nothing } http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/31ddd8f1/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/RandomAccessFileAppender.java ---------------------------------------------------------------------- diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/RandomAccessFileAppender.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/RandomAccessFileAppender.java index b0a6ee5..6522a54 100644 --- a/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/RandomAccessFileAppender.java +++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/RandomAccessFileAppender.java @@ -89,27 +89,27 @@ public final class RandomAccessFileAppender extends AbstractOutputStreamAppender immediateFlush, advertise ? configuration.getAdvertiser() : null); } - public B withFileName(String fileName) { + public B withFileName(final String fileName) { this.fileName = fileName; return asBuilder(); } - public B withAppend(boolean append) { + public B withAppend(final boolean append) { this.append = append; return asBuilder(); } - public B withAdvertise(boolean advertise) { + public B withAdvertise(final boolean advertise) { this.advertise = advertise; return asBuilder(); } - public B withAdvertiseURI(String advertiseURI) { + public B withAdvertiseURI(final String advertiseURI) { this.advertiseURI = advertiseURI; return asBuilder(); } - public B withConfiguration(Configuration configuration) { + public B withConfiguration(final Configuration configuration) { this.configuration = configuration; return asBuilder(); } http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/31ddd8f1/log4j-core/src/main/java/org/apache/logging/log4j/core/config/builder/impl/BuiltConfiguration.java ---------------------------------------------------------------------- diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/config/builder/impl/BuiltConfiguration.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/config/builder/impl/BuiltConfiguration.java index c241dfb..ae932ee 100644 --- a/log4j-core/src/main/java/org/apache/logging/log4j/core/config/builder/impl/BuiltConfiguration.java +++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/config/builder/impl/BuiltConfiguration.java @@ -147,7 +147,7 @@ public class BuiltConfiguration extends AbstractConfiguration { isShutdownHookEnabled = !"disable".equalsIgnoreCase(flag); } - public void setShutdownTimeoutMillis(long shutdownTimeoutMillis) { + public void setShutdownTimeoutMillis(final long shutdownTimeoutMillis) { this.shutdownTimeoutMillis = shutdownTimeoutMillis; } http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/31ddd8f1/log4j-core/src/main/java/org/apache/logging/log4j/core/layout/HtmlLayout.java ---------------------------------------------------------------------- diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/layout/HtmlLayout.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/layout/HtmlLayout.java index 3dcbd2b..4e9772a 100644 --- a/log4j-core/src/main/java/org/apache/logging/log4j/core/layout/HtmlLayout.java +++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/layout/HtmlLayout.java @@ -258,12 +258,12 @@ public final class HtmlLayout extends AbstractStringLayout { } } - private StringBuilder appendLs(StringBuilder sbuilder, String s) { + private StringBuilder appendLs(final StringBuilder sbuilder, final String s) { sbuilder.append(s).append(Strings.LINE_SEPARATOR); return sbuilder; } - private StringBuilder append(StringBuilder sbuilder, String s) { + private StringBuilder append(final StringBuilder sbuilder, final String s) { sbuilder.append(s); return sbuilder; } http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/31ddd8f1/log4j-core/src/main/java/org/apache/logging/log4j/core/layout/PatternLayout.java ---------------------------------------------------------------------- diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/layout/PatternLayout.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/layout/PatternLayout.java index f5c8a6e..2ec4254 100644 --- a/log4j-core/src/main/java/org/apache/logging/log4j/core/layout/PatternLayout.java +++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/layout/PatternLayout.java @@ -386,7 +386,7 @@ public final class PatternLayout extends AbstractStringLayout { return this; } - public SerializerBuilder withNoConsoleNoAnsi(boolean noConsoleNoAnsi) { + public SerializerBuilder withNoConsoleNoAnsi(final boolean noConsoleNoAnsi) { this.noConsoleNoAnsi = noConsoleNoAnsi; return this; } http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/31ddd8f1/log4j-core/src/main/java/org/apache/logging/log4j/core/lookup/StrSubstitutor.java ---------------------------------------------------------------------- diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/lookup/StrSubstitutor.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/lookup/StrSubstitutor.java index b7ef7e6..0500f17 100644 --- a/log4j-core/src/main/java/org/apache/logging/log4j/core/lookup/StrSubstitutor.java +++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/lookup/StrSubstitutor.java @@ -257,7 +257,7 @@ public class StrSubstitutor implements ConfigurationAware { * * @param properties the map with the variables' values, may be null */ - public StrSubstitutor(Properties properties) { + public StrSubstitutor(final Properties properties) { this(toTypeSafeMap(properties)); } @@ -391,7 +391,7 @@ public class StrSubstitutor implements ConfigurationAware { return StrSubstitutor.replace(source, valueMap); } - private static Map<String, String> toTypeSafeMap(Properties properties) { + private static Map<String, String> toTypeSafeMap(final Properties properties) { Map<String, String> map = new HashMap<>(properties.size()); for (final String name : properties.stringPropertyNames()) { map.put(name, properties.getProperty(name)); http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/31ddd8f1/log4j-core/src/main/java/org/apache/logging/log4j/core/net/server/AbstractSocketServer.java ---------------------------------------------------------------------- diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/net/server/AbstractSocketServer.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/net/server/AbstractSocketServer.java index ab0c945..0d28645 100644 --- a/log4j-core/src/main/java/org/apache/logging/log4j/core/net/server/AbstractSocketServer.java +++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/net/server/AbstractSocketServer.java @@ -99,7 +99,7 @@ public abstract class AbstractSocketServer<T extends InputStream> extends LogEve return localBindAddress; } - void setLocalBindAddress(InetAddress localBindAddress) { + void setLocalBindAddress(final InetAddress localBindAddress) { this.localBindAddress = localBindAddress; } } http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/31ddd8f1/log4j-core/src/main/java/org/apache/logging/log4j/core/net/server/TcpSocketServer.java ---------------------------------------------------------------------- diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/net/server/TcpSocketServer.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/net/server/TcpSocketServer.java index 72845bf..c60b6f4 100644 --- a/log4j-core/src/main/java/org/apache/logging/log4j/core/net/server/TcpSocketServer.java +++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/net/server/TcpSocketServer.java @@ -153,7 +153,7 @@ public class TcpSocketServer<T extends InputStream> extends AbstractSocketServer * @since 2.7 */ public static TcpSocketServer<ObjectInputStream> createSerializedSocketServer(final int port, final int backlog, - InetAddress localBindAddress) throws IOException { + final InetAddress localBindAddress) throws IOException { LOGGER.entry(port); final TcpSocketServer<ObjectInputStream> socketServer = new TcpSocketServer<>(port, backlog, localBindAddress, new ObjectInputStreamLogEventBridge()); @@ -229,7 +229,7 @@ public class TcpSocketServer<T extends InputStream> extends AbstractSocketServer * @since 2.7 */ @SuppressWarnings("resource") - public TcpSocketServer(final int port, final int backlog, InetAddress localBindAddress, final LogEventBridge<T> logEventInput) throws IOException { + public TcpSocketServer(final int port, final int backlog, final InetAddress localBindAddress, final LogEventBridge<T> logEventInput) throws IOException { this(port, logEventInput, new ServerSocket(port, backlog, localBindAddress)); } http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/31ddd8f1/log4j-core/src/main/java/org/apache/logging/log4j/core/net/ssl/AbstractKeyStoreConfiguration.java ---------------------------------------------------------------------- diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/net/ssl/AbstractKeyStoreConfiguration.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/net/ssl/AbstractKeyStoreConfiguration.java index 86bc844..460cd4b 100644 --- a/log4j-core/src/main/java/org/apache/logging/log4j/core/net/ssl/AbstractKeyStoreConfiguration.java +++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/net/ssl/AbstractKeyStoreConfiguration.java @@ -83,7 +83,7 @@ public class AbstractKeyStoreConfiguration extends StoreConfiguration<KeyStore> } @Override - public boolean equals(Object obj) { + public boolean equals(final Object obj) { if (this == obj) { return true; } http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/31ddd8f1/log4j-core/src/main/java/org/apache/logging/log4j/core/net/ssl/KeyStoreConfiguration.java ---------------------------------------------------------------------- diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/net/ssl/KeyStoreConfiguration.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/net/ssl/KeyStoreConfiguration.java index c168e7e..d2dac9c 100644 --- a/log4j-core/src/main/java/org/apache/logging/log4j/core/net/ssl/KeyStoreConfiguration.java +++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/net/ssl/KeyStoreConfiguration.java @@ -87,7 +87,7 @@ public class KeyStoreConfiguration extends AbstractKeyStoreConfiguration { } @Override - public boolean equals(Object obj) { + public boolean equals(final Object obj) { if (this == obj) { return true; } http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/31ddd8f1/log4j-core/src/main/java/org/apache/logging/log4j/core/net/ssl/SslConfiguration.java ---------------------------------------------------------------------- diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/net/ssl/SslConfiguration.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/net/ssl/SslConfiguration.java index 8632007..7c381b6 100644 --- a/log4j-core/src/main/java/org/apache/logging/log4j/core/net/ssl/SslConfiguration.java +++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/net/ssl/SslConfiguration.java @@ -234,7 +234,7 @@ public class SslConfiguration { } @Override - public boolean equals(Object obj) { + public boolean equals(final Object obj) { if (this == obj) { return true; } http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/31ddd8f1/log4j-core/src/main/java/org/apache/logging/log4j/core/net/ssl/TrustStoreConfiguration.java ---------------------------------------------------------------------- diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/net/ssl/TrustStoreConfiguration.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/net/ssl/TrustStoreConfiguration.java index 5164e23..d0f356e 100644 --- a/log4j-core/src/main/java/org/apache/logging/log4j/core/net/ssl/TrustStoreConfiguration.java +++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/net/ssl/TrustStoreConfiguration.java @@ -82,7 +82,7 @@ public class TrustStoreConfiguration extends AbstractKeyStoreConfiguration { } @Override - public boolean equals(Object obj) { + public boolean equals(final Object obj) { if (this == obj) { return true; } http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/31ddd8f1/log4j-core/src/main/java/org/apache/logging/log4j/core/pattern/EqualsIgnoreCaseReplacementConverter.java ---------------------------------------------------------------------- diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/pattern/EqualsIgnoreCaseReplacementConverter.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/pattern/EqualsIgnoreCaseReplacementConverter.java index 4d39c32..8e30ac5 100644 --- a/log4j-core/src/main/java/org/apache/logging/log4j/core/pattern/EqualsIgnoreCaseReplacementConverter.java +++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/pattern/EqualsIgnoreCaseReplacementConverter.java @@ -78,7 +78,7 @@ public final class EqualsIgnoreCaseReplacementConverter extends EqualsBaseReplac } @Override - protected boolean equals(String str, StringBuilder buff, int from, int len) { + protected boolean equals(final String str, final StringBuilder buff, final int from, final int len) { return StringBuilders.equalsIgnoreCase(str, 0, str.length(), buff, from, len); } } http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/31ddd8f1/log4j-core/src/main/java/org/apache/logging/log4j/core/pattern/EqualsReplacementConverter.java ---------------------------------------------------------------------- diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/pattern/EqualsReplacementConverter.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/pattern/EqualsReplacementConverter.java index 40a9451..da2938a 100644 --- a/log4j-core/src/main/java/org/apache/logging/log4j/core/pattern/EqualsReplacementConverter.java +++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/pattern/EqualsReplacementConverter.java @@ -76,7 +76,7 @@ public final class EqualsReplacementConverter extends EqualsBaseReplacementConve } @Override - protected boolean equals(String str, StringBuilder buff, int from, int len) { + protected boolean equals(final String str, final StringBuilder buff, final int from, final int len) { return StringBuilders.equals(str, 0, str.length(), buff, from, len); } } http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/31ddd8f1/log4j-core/src/main/java/org/apache/logging/log4j/core/util/BasicCommandLineArguments.java ---------------------------------------------------------------------- diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/util/BasicCommandLineArguments.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/util/BasicCommandLineArguments.java index 71271d8..f51d186 100644 --- a/log4j-core/src/main/java/org/apache/logging/log4j/core/util/BasicCommandLineArguments.java +++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/util/BasicCommandLineArguments.java @@ -40,7 +40,7 @@ public class BasicCommandLineArguments { return help; } - public void setHelp(boolean help) { + public void setHelp(final boolean help) { this.help = help; } http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/31ddd8f1/log4j-core/src/main/java/org/apache/logging/log4j/core/util/InetAddressConverter.java ---------------------------------------------------------------------- diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/util/InetAddressConverter.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/util/InetAddressConverter.java index ad93175..242fbc0 100644 --- a/log4j-core/src/main/java/org/apache/logging/log4j/core/util/InetAddressConverter.java +++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/util/InetAddressConverter.java @@ -24,7 +24,7 @@ import com.beust.jcommander.IStringConverter; public class InetAddressConverter implements IStringConverter<InetAddress> { @Override - public InetAddress convert(String host) { + public InetAddress convert(final String host) { try { return InetAddress.getByName(host); } catch (UnknownHostException e) { http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/31ddd8f1/log4j-to-slf4j/src/main/java/org/apache/logging/slf4j/MDCContextMap.java ---------------------------------------------------------------------- diff --git a/log4j-to-slf4j/src/main/java/org/apache/logging/slf4j/MDCContextMap.java b/log4j-to-slf4j/src/main/java/org/apache/logging/slf4j/MDCContextMap.java index 219323a..03b8564 100644 --- a/log4j-to-slf4j/src/main/java/org/apache/logging/slf4j/MDCContextMap.java +++ b/log4j-to-slf4j/src/main/java/org/apache/logging/slf4j/MDCContextMap.java @@ -58,7 +58,7 @@ public class MDCContextMap implements ThreadContextMap3 { @Override - public void removeAll(Iterable<String> keys) { + public void removeAll(final Iterable<String> keys) { for (final String key : keys) { MDC.remove(key); } http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/31ddd8f1/log4j-web/src/main/java/org/apache/logging/log4j/web/appender/ServletAppender.java ---------------------------------------------------------------------- diff --git a/log4j-web/src/main/java/org/apache/logging/log4j/web/appender/ServletAppender.java b/log4j-web/src/main/java/org/apache/logging/log4j/web/appender/ServletAppender.java index a0c9478..b7e30c2 100644 --- a/log4j-web/src/main/java/org/apache/logging/log4j/web/appender/ServletAppender.java +++ b/log4j-web/src/main/java/org/apache/logging/log4j/web/appender/ServletAppender.java @@ -76,7 +76,7 @@ public class ServletAppender extends AbstractAppender { /** * Logs with {@link ServletContext#log(String, Throwable)} if true and with {@link ServletContext#log(String)} if false. */ - public void setLogThrowables(boolean logThrowables) { + public void setLogThrowables(final boolean logThrowables) { this.logThrowables = logThrowables; } @@ -118,7 +118,7 @@ public class ServletAppender extends AbstractAppender { * @deprecated Use {@link #newBuilder()}. */ @Deprecated - public static ServletAppender createAppender(Layout<? extends Serializable> layout, final Filter filter, + public static ServletAppender createAppender(final Layout<? extends Serializable> layout, final Filter filter, final String name, final boolean ignoreExceptions) { // @formatter:off return newBuilder()
