You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by gg...@apache.org on 2012/12/10 20:37:03 UTC
svn commit: r1419697 [9/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/...
Modified: logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/layout/PatternLayout.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/layout/PatternLayout.java?rev=1419697&r1=1419696&r2=1419697&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/layout/PatternLayout.java (original)
+++ logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/layout/PatternLayout.java Mon Dec 10 19:36:06 2012
@@ -100,13 +100,13 @@ public final class PatternLayout extends
* @param pattern conversion pattern.
* @param charset The character set.
*/
- private PatternLayout(Configuration config, final RegexReplacement replace, final String pattern,
+ private PatternLayout(final Configuration config, final RegexReplacement replace, final String pattern,
final Charset charset) {
super(charset);
this.replace = replace;
this.conversionPattern = pattern;
this.config = config;
- PatternParser parser = createPatternParser(config);
+ final PatternParser parser = createPatternParser(config);
formatters = parser.parse((pattern == null) ? DEFAULT_CONVERSION_PATTERN : pattern);
handlesExceptions = parser.handlesExceptions();
}
@@ -119,11 +119,11 @@ public final class PatternLayout extends
* @param conversionPattern conversion pattern.
*/
public void setConversionPattern(final String conversionPattern) {
- String pattern = OptionConverter.convertSpecialChars(conversionPattern);
+ final String pattern = OptionConverter.convertSpecialChars(conversionPattern);
if (pattern == null) {
return;
}
- PatternParser parser = createPatternParser(this.config);
+ final PatternParser parser = createPatternParser(this.config);
formatters = parser.parse(pattern);
handlesExceptions = parser.handlesExceptions();
}
@@ -136,8 +136,8 @@ public final class PatternLayout extends
* @return The event formatted as a String.
*/
public String toSerializable(final LogEvent event) {
- StringBuilder buf = new StringBuilder();
- for (PatternFormatter formatter : formatters) {
+ final StringBuilder buf = new StringBuilder();
+ for (final PatternFormatter formatter : formatters) {
formatter.format(event, buf);
}
String str = buf.toString();
@@ -152,7 +152,7 @@ public final class PatternLayout extends
* @param config The Configuration.
* @return The PatternParser.
*/
- public static PatternParser createPatternParser(Configuration config) {
+ public static PatternParser createPatternParser(final Configuration config) {
if (config == null) {
return new PatternParser(config, KEY, LogEventPatternConverter.class);
}
@@ -179,10 +179,10 @@ public final class PatternLayout extends
* @return The PatternLayout.
*/
@PluginFactory
- public static PatternLayout createLayout(@PluginAttr("pattern") String pattern,
- @PluginConfiguration Configuration config,
- @PluginElement("replace") RegexReplacement replace,
- @PluginAttr("charset") String charset) {
+ public static PatternLayout createLayout(@PluginAttr("pattern") final String pattern,
+ @PluginConfiguration final Configuration config,
+ @PluginElement("replace") final RegexReplacement replace,
+ @PluginAttr("charset") final String charset) {
Charset c = Charset.isSupported("UTF-8") ? Charset.forName("UTF-8") : Charset.defaultCharset();
if (charset != null) {
if (Charset.isSupported(charset)) {
Modified: logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/layout/RFC5424Layout.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/layout/RFC5424Layout.java?rev=1419697&r1=1419696&r2=1419697&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/layout/RFC5424Layout.java (original)
+++ logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/layout/RFC5424Layout.java Mon Dec 10 19:36:06 2012
@@ -85,9 +85,9 @@ public final class RFC5424Layout extends
private String timestamppStr;
- private RFC5424Layout(Configuration config, Facility facility, String id, int ein, boolean includeMDC,
- boolean includeNL, String mdcId, String appName, String messageId, String excludes,
- String includes, String required, Charset charset) {
+ private RFC5424Layout(final Configuration config, final Facility facility, final String id, final int ein, final boolean includeMDC,
+ final boolean includeNL, final String mdcId, final String appName, final String messageId, final String excludes,
+ final String includes, final String required, final Charset charset) {
super(charset);
this.facility = facility;
this.defaultId = id == null ? DEFAULT_ID : id;
@@ -100,11 +100,11 @@ public final class RFC5424Layout extends
this.localHostName = getLocalHostname();
ListChecker c = null;
if (excludes != null) {
- String[] array = excludes.split(",");
+ final String[] array = excludes.split(",");
if (array.length > 0) {
c = new ExcludeChecker();
mdcExcludes = new ArrayList<String>(array.length);
- for (String str : array) {
+ for (final String str : array) {
mdcExcludes.add(str.trim());
}
} else {
@@ -114,11 +114,11 @@ public final class RFC5424Layout extends
mdcExcludes = null;
}
if (includes != null) {
- String[] array = includes.split(",");
+ final String[] array = includes.split(",");
if (array.length > 0) {
c = new IncludeChecker();
mdcIncludes = new ArrayList<String>(array.length);
- for (String str : array) {
+ for (final String str : array) {
mdcIncludes.add(str.trim());
}
} else {
@@ -128,10 +128,10 @@ public final class RFC5424Layout extends
mdcIncludes = null;
}
if (required != null) {
- String[] array = required.split(",");
+ final String[] array = required.split(",");
if (array.length > 0) {
mdcRequired = new ArrayList<String>(array.length);
- for (String str : array) {
+ for (final String str : array) {
mdcRequired.add(str.trim());
}
} else {
@@ -142,7 +142,7 @@ public final class RFC5424Layout extends
mdcRequired = null;
}
this.checker = c != null ? c : noopChecker;
- String name = config == null ? null : config.getName();
+ final String name = config == null ? null : config.getName();
configName = (name != null && name.length() > 0) ? name : null;
}
@@ -153,9 +153,9 @@ public final class RFC5424Layout extends
* @return The RFC 5424 String representation of the LogEvent.
*/
public String toSerializable(final LogEvent event) {
- Message msg = event.getMessage();
- boolean isStructured = msg instanceof StructuredDataMessage;
- StringBuilder buf = new StringBuilder();
+ final Message msg = event.getMessage();
+ final boolean isStructured = msg instanceof StructuredDataMessage;
+ final StringBuilder buf = new StringBuilder();
buf.append("<");
buf.append(Priority.getPriority(facility, event.getLevel()));
@@ -174,7 +174,7 @@ public final class RFC5424Layout extends
buf.append(" ");
buf.append(getProcId());
buf.append(" ");
- String type = isStructured ? ((StructuredDataMessage) msg).getType() : null;
+ final String type = isStructured ? ((StructuredDataMessage) msg).getType() : null;
if (type != null) {
buf.append(type);
} else if (messageId != null) {
@@ -187,8 +187,8 @@ public final class RFC5424Layout extends
StructuredDataId id = null;
String text;
if (isStructured) {
- StructuredDataMessage data = (StructuredDataMessage) msg;
- Map<String, String> map = data.getData();
+ final StructuredDataMessage data = (StructuredDataMessage) msg;
+ final Map<String, String> map = data.getData();
id = data.getId();
formatStructuredElement(id, map, buf, noopChecker);
text = data.getFormat();
@@ -199,8 +199,8 @@ public final class RFC5424Layout extends
if (mdcRequired != null) {
checkRequired(event.getContextMap());
}
- int ein = id == null || id.getEnterpriseNumber() < 0 ? enterpriseNumber : id.getEnterpriseNumber();
- StructuredDataId mdcSDID = new StructuredDataId(mdcId, ein, null, null);
+ final int ein = id == null || id.getEnterpriseNumber() < 0 ? enterpriseNumber : id.getEnterpriseNumber();
+ final StructuredDataId mdcSDID = new StructuredDataId(mdcId, ein, null, null);
formatStructuredElement(mdcSDID, event.getContextMap(), buf, checker);
}
if (text != null && text.length() > 0) {
@@ -229,25 +229,25 @@ public final class RFC5424Layout extends
*/
public String getLocalHostname() {
try {
- InetAddress addr = InetAddress.getLocalHost();
+ final InetAddress addr = InetAddress.getLocalHost();
return addr.getHostName();
- } catch (UnknownHostException uhe) {
+ } catch (final UnknownHostException uhe) {
try {
- Enumeration<NetworkInterface> interfaces = NetworkInterface.getNetworkInterfaces();
+ final Enumeration<NetworkInterface> interfaces = NetworkInterface.getNetworkInterfaces();
while (interfaces.hasMoreElements()) {
- NetworkInterface nic = interfaces.nextElement();
- Enumeration<InetAddress> addresses = nic.getInetAddresses();
+ final NetworkInterface nic = interfaces.nextElement();
+ final Enumeration<InetAddress> addresses = nic.getInetAddresses();
while (addresses.hasMoreElements()) {
- InetAddress address = addresses.nextElement();
+ final InetAddress address = addresses.nextElement();
if (!address.isLoopbackAddress()) {
- String hostname = address.getHostName();
+ final String hostname = address.getHostName();
if (hostname != null) {
return hostname;
}
}
}
}
- } catch (SocketException se) {
+ } catch (final SocketException se) {
LOGGER.error("Could not determine local host name", uhe);
return "UNKNOWN_LOCALHOST";
}
@@ -264,7 +264,7 @@ public final class RFC5424Layout extends
return mdcIncludes;
}
- private String computeTimeStampString(long now) {
+ private String computeTimeStampString(final long now) {
long last;
synchronized (this) {
last = lastTimestamp;
@@ -273,8 +273,8 @@ public final class RFC5424Layout extends
}
}
- StringBuilder buf = new StringBuilder();
- Calendar cal = new GregorianCalendar();
+ final StringBuilder buf = new StringBuilder();
+ final Calendar cal = new GregorianCalendar();
cal.setTimeInMillis(now);
buf.append(Integer.toString(cal.get(Calendar.YEAR)));
buf.append("-");
@@ -288,7 +288,7 @@ public final class RFC5424Layout extends
buf.append(":");
pad(cal.get(Calendar.SECOND), TWO_DIGITS, buf);
- int millis = cal.get(Calendar.MILLISECOND);
+ final int millis = cal.get(Calendar.MILLISECOND);
if (millis != 0) {
buf.append('.');
pad(millis, THREE_DIGITS, buf);
@@ -304,7 +304,7 @@ public final class RFC5424Layout extends
} else {
buf.append("+");
}
- int tzhour = tzmin / MINUTES_PER_HOUR;
+ final int tzhour = tzmin / MINUTES_PER_HOUR;
tzmin -= tzhour * MINUTES_PER_HOUR;
pad(tzhour, TWO_DIGITS, buf);
buf.append(":");
@@ -319,7 +319,7 @@ public final class RFC5424Layout extends
return buf.toString();
}
- private void pad(int val, int max, StringBuilder buf) {
+ private void pad(final int val, int max, final StringBuilder buf) {
while (max > 1) {
if (val < max) {
buf.append("0");
@@ -329,8 +329,8 @@ public final class RFC5424Layout extends
buf.append(Integer.toString(val));
}
- private void formatStructuredElement(StructuredDataId id, Map<String, String> data, StringBuilder sb,
- ListChecker checker) {
+ private void formatStructuredElement(final StructuredDataId id, final Map<String, String> data, final StringBuilder sb,
+ final ListChecker checker) {
if (id == null && defaultId == null) {
return;
}
@@ -340,8 +340,8 @@ public final class RFC5424Layout extends
sb.append("]");
}
- private String getId(StructuredDataId id) {
- StringBuilder sb = new StringBuilder();
+ private String getId(final StructuredDataId id) {
+ final StringBuilder sb = new StringBuilder();
if (id.getName() == null) {
sb.append(defaultId);
} else {
@@ -357,19 +357,19 @@ public final class RFC5424Layout extends
return sb.toString();
}
- private void checkRequired(Map<String, String> map) {
- for (String key : mdcRequired) {
- String value = map.get(key);
+ private void checkRequired(final Map<String, String> map) {
+ for (final String key : mdcRequired) {
+ final String value = map.get(key);
if (value == null) {
throw new LoggingException("Required key " + key + " is missing from the " + mdcId);
}
}
}
- private void appendMap(Map<String, String> map, StringBuilder sb, ListChecker checker)
+ private void appendMap(final Map<String, String> map, final StringBuilder sb, final ListChecker checker)
{
- SortedMap<String, String> sorted = new TreeMap<String, String>(map);
- for (Map.Entry<String, String> entry : sorted.entrySet()) {
+ final SortedMap<String, String> sorted = new TreeMap<String, String>(map);
+ for (final Map.Entry<String, String> entry : sorted.entrySet()) {
if (checker.check(entry.getKey()) && entry.getValue() != null) {
sb.append(" ");
sb.append(entry.getKey()).append("=\"").append(entry.getValue()).append("\"");
@@ -388,7 +388,7 @@ public final class RFC5424Layout extends
* Includes only the listed keys.
*/
private class IncludeChecker implements ListChecker {
- public boolean check(String key) {
+ public boolean check(final String key) {
return mdcIncludes.contains(key);
}
}
@@ -397,7 +397,7 @@ public final class RFC5424Layout extends
* Excludes the listed keys.
*/
private class ExcludeChecker implements ListChecker {
- public boolean check(String key) {
+ public boolean check(final String key) {
return !mdcExcludes.contains(key);
}
}
@@ -406,14 +406,14 @@ public final class RFC5424Layout extends
* Does nothing.
*/
private class NoopChecker implements ListChecker {
- public boolean check(String key) {
+ public boolean check(final String key) {
return true;
}
}
@Override
public String toString() {
- StringBuilder sb = new StringBuilder();
+ final StringBuilder sb = new StringBuilder();
sb.append("facility=").append(facility.name());
sb.append(" appName=").append(appName);
sb.append(" defaultId=").append(defaultId);
@@ -443,19 +443,19 @@ public final class RFC5424Layout extends
* @return An RFC5424Layout.
*/
@PluginFactory
- public static RFC5424Layout createLayout(@PluginAttr("facility") String facility,
- @PluginAttr("id") String id,
- @PluginAttr("enterpriseNumber") String ein,
- @PluginAttr("includeMDC") String includeMDC,
+ public static RFC5424Layout createLayout(@PluginAttr("facility") final String facility,
+ @PluginAttr("id") final String id,
+ @PluginAttr("enterpriseNumber") final String ein,
+ @PluginAttr("includeMDC") final String includeMDC,
@PluginAttr("mdcId") String mdcId,
- @PluginAttr("newLine") String includeNL,
- @PluginAttr("appName") String appName,
- @PluginAttr("messageId") String msgId,
- @PluginAttr("mdcExcludes") String excludes,
+ @PluginAttr("newLine") final String includeNL,
+ @PluginAttr("appName") final String appName,
+ @PluginAttr("messageId") final String msgId,
+ @PluginAttr("mdcExcludes") final String excludes,
@PluginAttr("mdcIncludes") String includes,
- @PluginAttr("mdcRequired") String required,
- @PluginAttr("charset") String charset,
- @PluginConfiguration Configuration config) {
+ @PluginAttr("mdcRequired") final String required,
+ @PluginAttr("charset") final String charset,
+ @PluginConfiguration final Configuration config) {
Charset c = Charset.isSupported("UTF-8") ? Charset.forName("UTF-8") : Charset.defaultCharset();
if (charset != null) {
if (Charset.isSupported(charset)) {
@@ -468,10 +468,10 @@ public final class RFC5424Layout extends
LOGGER.error("mdcIncludes and mdcExcludes are mutually exclusive. Includes wil be ignored");
includes = null;
}
- Facility f = Facility.toFacility(facility, Facility.LOCAL0);
- int enterpriseNumber = ein == null ? DEFAULT_ENTERPRISE_NUMBER : Integer.parseInt(ein);
- boolean isMdc = includeMDC == null ? true : Boolean.valueOf(includeMDC);
- boolean includeNewLine = includeNL == null ? false : Boolean.valueOf(includeNL);
+ final Facility f = Facility.toFacility(facility, Facility.LOCAL0);
+ final int enterpriseNumber = ein == null ? DEFAULT_ENTERPRISE_NUMBER : Integer.parseInt(ein);
+ final boolean isMdc = includeMDC == null ? true : Boolean.valueOf(includeMDC);
+ final boolean includeNewLine = includeNL == null ? false : Boolean.valueOf(includeNL);
if (mdcId == null) {
mdcId = DEFAULT_MDCID;
}
Modified: logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/layout/SerializedLayout.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/layout/SerializedLayout.java?rev=1419697&r1=1419696&r2=1419697&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/layout/SerializedLayout.java (original)
+++ logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/layout/SerializedLayout.java Mon Dec 10 19:36:06 2012
@@ -34,12 +34,12 @@ public final class SerializedLayout exte
private static byte[] header;
static {
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ final ByteArrayOutputStream baos = new ByteArrayOutputStream();
try {
- ObjectOutputStream oos = new ObjectOutputStream(baos);
+ final ObjectOutputStream oos = new ObjectOutputStream(baos);
oos.close();
header = baos.toByteArray();
- } catch (Exception ex) {
+ } catch (final Exception ex) {
LOGGER.error("Unable to generate Object stream header", ex);
}
}
@@ -54,15 +54,15 @@ public final class SerializedLayout exte
* @return the formatted LogEvent.
*/
public byte[] toByteArray(final LogEvent event) {
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ final ByteArrayOutputStream baos = new ByteArrayOutputStream();
try {
- ObjectOutputStream oos = new PrivateObjectOutputStream(baos);
+ final ObjectOutputStream oos = new PrivateObjectOutputStream(baos);
try {
oos.writeObject(event);
} finally {
oos.close();
}
- } catch (IOException ioe) {
+ } catch (final IOException ioe) {
LOGGER.error("Serialization of LogEvent failed.", ioe);
}
return baos.toByteArray();
@@ -98,7 +98,7 @@ public final class SerializedLayout exte
*/
private class PrivateObjectOutputStream extends ObjectOutputStream {
- public PrivateObjectOutputStream(OutputStream os) throws IOException {
+ public PrivateObjectOutputStream(final OutputStream os) throws IOException {
super(os);
}
Modified: logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/layout/SyslogLayout.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/layout/SyslogLayout.java?rev=1419697&r1=1419696&r2=1419697&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/layout/SyslogLayout.java (original)
+++ logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/layout/SyslogLayout.java Mon Dec 10 19:36:06 2012
@@ -50,7 +50,7 @@ public class SyslogLayout extends Abstra
private final String localHostname = getLocalHostname();
- protected SyslogLayout(Facility facility, boolean includeNL, Charset c) {
+ protected SyslogLayout(final Facility facility, final boolean includeNL, final Charset c) {
super(c);
this.facility = facility;
this.includeNewLine = includeNL;
@@ -63,7 +63,7 @@ public class SyslogLayout extends Abstra
* @return the event formatted as a String.
*/
public String toSerializable(final LogEvent event) {
- StringBuilder buf = new StringBuilder();
+ final StringBuilder buf = new StringBuilder();
buf.append("<");
buf.append(Priority.getPriority(facility, event.getLevel()));
@@ -88,16 +88,16 @@ public class SyslogLayout extends Abstra
*/
private String getLocalHostname() {
try {
- InetAddress addr = InetAddress.getLocalHost();
+ final InetAddress addr = InetAddress.getLocalHost();
return addr.getHostName();
- } catch (UnknownHostException uhe) {
+ } catch (final UnknownHostException uhe) {
LOGGER.error("Could not determine local host name", uhe);
return "UNKNOWN_LOCALHOST";
}
}
- private synchronized void addDate(final long timestamp, StringBuilder buf) {
- int index = buf.length() + 4;
+ private synchronized void addDate(final long timestamp, final StringBuilder buf) {
+ final int index = buf.length() + 4;
buf.append(dateFormat.format(new Date(timestamp)));
// RFC 3164 says leading space, not leading zero on days 1-9
if (buf.charAt(index) == '0') {
@@ -113,9 +113,9 @@ public class SyslogLayout extends Abstra
* @return A SyslogLayout.
*/
@PluginFactory
- public static SyslogLayout createLayout(@PluginAttr("facility") String facility,
- @PluginAttr("newLine") String includeNL,
- @PluginAttr("charset") String charset) {
+ public static SyslogLayout createLayout(@PluginAttr("facility") final String facility,
+ @PluginAttr("newLine") final String includeNL,
+ @PluginAttr("charset") final String charset) {
Charset c = Charset.isSupported("UTF-8") ? Charset.forName("UTF-8") : Charset.defaultCharset();
if (charset != null) {
@@ -125,8 +125,8 @@ public class SyslogLayout extends Abstra
LOGGER.error("Charset " + charset + " is not supported for layout, using " + c.displayName());
}
}
- boolean includeNewLine = includeNL == null ? false : Boolean.valueOf(includeNL);
- Facility f = Facility.toFacility(facility, Facility.LOCAL0);
+ final boolean includeNewLine = includeNL == null ? false : Boolean.valueOf(includeNL);
+ final Facility f = Facility.toFacility(facility, Facility.LOCAL0);
return new SyslogLayout(f, includeNewLine, c);
}
}
Modified: logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/layout/XMLLayout.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/layout/XMLLayout.java?rev=1419697&r1=1419696&r2=1419697&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/layout/XMLLayout.java (original)
+++ logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/layout/XMLLayout.java Mon Dec 10 19:36:06 2012
@@ -81,7 +81,7 @@ public class XMLLayout extends AbstractS
private final boolean properties;
private final boolean complete;
- protected XMLLayout(boolean locationInfo, boolean properties, boolean complete, Charset charset) {
+ protected XMLLayout(final boolean locationInfo, final boolean properties, final boolean complete, final Charset charset) {
super(charset);
this.locationInfo = locationInfo;
this.properties = properties;
@@ -95,7 +95,7 @@ public class XMLLayout extends AbstractS
* @return The XML representation of the LogEvent.
*/
public String toSerializable(final LogEvent event) {
- StringBuilder buf = new StringBuilder(DEFAULT_SIZE);
+ final StringBuilder buf = new StringBuilder(DEFAULT_SIZE);
// We yield to the \r\n heresy.
@@ -113,12 +113,12 @@ public class XMLLayout extends AbstractS
buf.append(Transform.escapeTags(event.getThreadName()));
buf.append("\">\r\n");
- Message msg = event.getMessage();
+ final Message msg = event.getMessage();
if (msg != null) {
boolean xmlSupported = false;
if (msg instanceof MultiformatMessage) {
- String[] formats = ((MultiformatMessage) msg).getFormats();
- for (String format : formats) {
+ final String[] formats = ((MultiformatMessage) msg).getFormats();
+ for (final String format : formats) {
if (format.equalsIgnoreCase("XML")) {
xmlSupported = true;
}
@@ -143,11 +143,11 @@ public class XMLLayout extends AbstractS
buf.append("]]></log4j:NDC>\r\n");
}
- Throwable throwable = event.getThrown();
+ final Throwable throwable = event.getThrown();
if (throwable != null) {
- List<String> s = getThrowableString(throwable);
+ final List<String> s = getThrowableString(throwable);
buf.append("<log4j:throwable><![CDATA[");
- for (String str : s) {
+ for (final String str : s) {
Transform.appendEscapingCDATA(buf, str);
buf.append("\r\n");
}
@@ -155,7 +155,7 @@ public class XMLLayout extends AbstractS
}
if (locationInfo) {
- StackTraceElement element = event.getSource();
+ final StackTraceElement element = event.getSource();
buf.append("<log4j:locationInfo class=\"");
buf.append(Transform.escapeTags(element.getClassName()));
buf.append("\" method=\"");
@@ -169,7 +169,7 @@ public class XMLLayout extends AbstractS
if (properties && event.getContextMap().size() > 0) {
buf.append("<log4j:properties>\r\n");
- for (Map.Entry<String, String> entry : event.getContextMap().entrySet()) {
+ for (final Map.Entry<String, String> entry : event.getContextMap().entrySet()) {
buf.append("<log4j:data name=\"");
buf.append(Transform.escapeTags(entry.getKey()));
buf.append("\" value=\"");
@@ -193,7 +193,7 @@ public class XMLLayout extends AbstractS
if (!complete) {
return null;
}
- StringBuilder sbuf = new StringBuilder();
+ final StringBuilder sbuf = new StringBuilder();
sbuf.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n");
sbuf.append("<log4j:eventSet xmlns:log4j=\"http://logging.apache.org/log4j/\">\r\n");
return sbuf.toString().getBytes(getCharset());
@@ -209,29 +209,29 @@ public class XMLLayout extends AbstractS
if (!complete) {
return null;
}
- StringBuilder sbuf = new StringBuilder();
+ final StringBuilder sbuf = new StringBuilder();
sbuf.append("</log4j:eventSet>\r\n");
return sbuf.toString().getBytes(getCharset());
}
- List<String> getThrowableString(Throwable throwable) {
- StringWriter sw = new StringWriter();
- PrintWriter pw = new PrintWriter(sw);
+ List<String> getThrowableString(final Throwable throwable) {
+ final StringWriter sw = new StringWriter();
+ final PrintWriter pw = new PrintWriter(sw);
try {
throwable.printStackTrace(pw);
- } catch (RuntimeException ex) {
+ } catch (final RuntimeException ex) {
// Ignore any exceptions.
}
pw.flush();
- LineNumberReader reader = new LineNumberReader(new StringReader(sw.toString()));
- ArrayList<String> lines = new ArrayList<String>();
+ final LineNumberReader reader = new LineNumberReader(new StringReader(sw.toString()));
+ final ArrayList<String> lines = new ArrayList<String>();
try {
String line = reader.readLine();
while (line != null) {
lines.add(line);
line = reader.readLine();
}
- } catch (IOException ex) {
+ } catch (final IOException ex) {
if (ex instanceof InterruptedIOException) {
Thread.currentThread().interrupt();
}
@@ -249,10 +249,10 @@ public class XMLLayout extends AbstractS
* @return An XML Layout.
*/
@PluginFactory
- public static XMLLayout createLayout(@PluginAttr("locationInfo") String locationInfo,
- @PluginAttr("properties") String properties,
- @PluginAttr("complete") String complete,
- @PluginAttr("charset") String charset) {
+ public static XMLLayout createLayout(@PluginAttr("locationInfo") final String locationInfo,
+ @PluginAttr("properties") final String properties,
+ @PluginAttr("complete") final String complete,
+ @PluginAttr("charset") final String charset) {
Charset c = Charset.isSupported("UTF-8") ? Charset.forName("UTF-8") : Charset.defaultCharset();
if (charset != null) {
if (Charset.isSupported(charset)) {
@@ -261,9 +261,9 @@ public class XMLLayout extends AbstractS
LOGGER.error("Charset " + charset + " is not supported for layout, using " + c.displayName());
}
}
- boolean info = locationInfo == null ? false : Boolean.valueOf(locationInfo);
- boolean props = properties == null ? false : Boolean.valueOf(properties);
- boolean comp = complete == null ? false : Boolean.valueOf(complete);
+ final boolean info = locationInfo == null ? false : Boolean.valueOf(locationInfo);
+ final boolean props = properties == null ? false : Boolean.valueOf(properties);
+ final boolean comp = complete == null ? false : Boolean.valueOf(complete);
return new XMLLayout(info, props, comp, c);
}
}
Modified: logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/lookup/ContextMapLookup.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/lookup/ContextMapLookup.java?rev=1419697&r1=1419696&r2=1419697&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/lookup/ContextMapLookup.java (original)
+++ logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/lookup/ContextMapLookup.java Mon Dec 10 19:36:06 2012
@@ -31,7 +31,7 @@ public class ContextMapLookup implements
* @param key the key to be looked up, may be null
* @return The value associated with the key.
*/
- public String lookup(String key) {
+ public String lookup(final String key) {
return ThreadContext.get(key);
}
@@ -41,7 +41,7 @@ public class ContextMapLookup implements
* @param key the key to be looked up, may be null
* @return The value associated with the key.
*/
- public String lookup(LogEvent event, String key) {
+ public String lookup(final LogEvent event, final String key) {
return event.getContextMap().get(key);
}
}
Modified: logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/lookup/DateLookup.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/lookup/DateLookup.java?rev=1419697&r1=1419696&r2=1419697&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/lookup/DateLookup.java (original)
+++ logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/lookup/DateLookup.java Mon Dec 10 19:36:06 2012
@@ -37,7 +37,7 @@ public class DateLookup implements StrLo
* @param key the format to use. If null, the default DateFormat will be used.
* @return The value of the environment variable.
*/
- public String lookup(String key) {
+ public String lookup(final String key) {
return formatDate(System.currentTimeMillis(), key);
}
@@ -47,16 +47,16 @@ public class DateLookup implements StrLo
* @param key the format to use. If null, the default DateFormat will be used.
* @return The value of the environment variable.
*/
- public String lookup(LogEvent event, String key) {
+ public String lookup(final LogEvent event, final String key) {
return formatDate(event.getMillis(), key);
}
- private String formatDate(long date, String format) {
+ private String formatDate(final long date, final String format) {
DateFormat dateFormat = null;
if (format != null) {
try {
dateFormat = new SimpleDateFormat(format);
- } catch (Exception ex) {
+ } catch (final Exception ex) {
LOGGER.error("Invalid date format: \"" + format + "\", using default", ex);
}
}
Modified: logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/lookup/EnvironmentLookup.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/lookup/EnvironmentLookup.java?rev=1419697&r1=1419696&r2=1419697&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/lookup/EnvironmentLookup.java (original)
+++ logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/lookup/EnvironmentLookup.java Mon Dec 10 19:36:06 2012
@@ -30,7 +30,7 @@ public class EnvironmentLookup implement
* @param key the key to be looked up, may be null
* @return The value of the environment variable.
*/
- public String lookup(String key) {
+ public String lookup(final String key) {
return System.getenv(key);
}
@@ -40,7 +40,7 @@ public class EnvironmentLookup implement
* @param key the key to be looked up, may be null
* @return The value of the environment variable.
*/
- public String lookup(LogEvent event, String key) {
+ public String lookup(final LogEvent event, final String key) {
return System.getenv(key);
}
}
Modified: logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/lookup/Interpolator.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/lookup/Interpolator.java?rev=1419697&r1=1419696&r2=1419697&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/lookup/Interpolator.java (original)
+++ logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/lookup/Interpolator.java Mon Dec 10 19:36:06 2012
@@ -39,17 +39,17 @@ public class Interpolator implements Str
private final StrLookup defaultLookup;
- public Interpolator(StrLookup defaultLookup) {
+ public Interpolator(final StrLookup defaultLookup) {
this.defaultLookup = defaultLookup == null ? new MapLookup(new HashMap<String, String>()) : defaultLookup;
- PluginManager manager = new PluginManager("Lookup");
+ final PluginManager manager = new PluginManager("Lookup");
manager.collectPlugins();
- Map<String, PluginType> plugins = manager.getPlugins();
+ final Map<String, PluginType> plugins = manager.getPlugins();
- for (Map.Entry<String, PluginType> entry : plugins.entrySet()) {
- Class<StrLookup> clazz = entry.getValue().getPluginClass();
+ for (final Map.Entry<String, PluginType> entry : plugins.entrySet()) {
+ final Class<StrLookup> clazz = entry.getValue().getPluginClass();
try {
lookups.put(entry.getKey(), clazz.newInstance());
- } catch (Exception ex) {
+ } catch (final Exception ex) {
LOGGER.error("Unable to create Lookup for " + entry.getKey(), ex);
}
}
@@ -72,7 +72,7 @@ public class Interpolator implements Str
* @return the value of this variable or <b>null</b> if it cannot be
* resolved
*/
- public String lookup(String var) {
+ public String lookup(final String var) {
return lookup(null, var);
}
@@ -89,16 +89,16 @@ public class Interpolator implements Str
* @return the value of this variable or <b>null</b> if it cannot be
* resolved
*/
- public String lookup(LogEvent event, String var) {
+ public String lookup(final LogEvent event, String var) {
if (var == null) {
return null;
}
- int prefixPos = var.indexOf(PREFIX_SEPARATOR);
+ final int prefixPos = var.indexOf(PREFIX_SEPARATOR);
if (prefixPos >= 0) {
- String prefix = var.substring(0, prefixPos);
- String name = var.substring(prefixPos + 1);
- StrLookup lookup = lookups.get(prefix);
+ final String prefix = var.substring(0, prefixPos);
+ final String name = var.substring(prefixPos + 1);
+ final StrLookup lookup = lookups.get(prefix);
String value = null;
if (lookup != null) {
value = event == null ? lookup.lookup(name) : lookup.lookup(event, name);
@@ -117,8 +117,8 @@ public class Interpolator implements Str
@Override
public String toString() {
- StringBuilder sb = new StringBuilder();
- for (String name : lookups.keySet()) {
+ final StringBuilder sb = new StringBuilder();
+ for (final String name : lookups.keySet()) {
if (sb.length() == 0) {
sb.append("{");
} else {
Modified: logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/lookup/MapLookup.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/lookup/MapLookup.java?rev=1419697&r1=1419696&r2=1419697&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/lookup/MapLookup.java (original)
+++ logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/lookup/MapLookup.java Mon Dec 10 19:36:06 2012
@@ -38,7 +38,7 @@ public class MapLookup<V> implements Str
*
* @param map the map of keys to values, may be null
*/
- public MapLookup(Map<String, V> map) {
+ public MapLookup(final Map<String, V> map) {
this.map = map;
}
@@ -58,23 +58,23 @@ public class MapLookup<V> implements Str
* @param key the key to be looked up, may be null
* @return the matching value, null if no match
*/
- public String lookup(String key) {
+ public String lookup(final String key) {
if (map == null) {
return null;
}
- Object obj = map.get(key);
+ final Object obj = map.get(key);
if (obj == null) {
return null;
}
return obj.toString();
}
- public String lookup(LogEvent event, String key) {
+ public String lookup(final LogEvent event, final String key) {
if (map == null && !(event.getMessage() instanceof MapMessage)) {
return null;
}
if (map != null && map.containsKey(key)) {
- Object obj = map.get(key);
+ final Object obj = map.get(key);
if (obj != null) {
return obj.toString();
}
Modified: logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/lookup/StrMatcher.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/lookup/StrMatcher.java?rev=1419697&r1=1419696&r2=1419697&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/lookup/StrMatcher.java (original)
+++ logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/lookup/StrMatcher.java Mon Dec 10 19:36:06 2012
@@ -159,7 +159,7 @@ public abstract class StrMatcher {
* @param ch the character to match, must not be null
* @return a new Matcher for the given char
*/
- public static StrMatcher charMatcher(char ch) {
+ public static StrMatcher charMatcher(final char ch) {
return new CharMatcher(ch);
}
@@ -169,7 +169,7 @@ public abstract class StrMatcher {
* @param chars the characters to match, null or empty matches nothing
* @return a new matcher for the given char[]
*/
- public static StrMatcher charSetMatcher(char[] chars) {
+ public static StrMatcher charSetMatcher(final char[] chars) {
if (chars == null || chars.length == 0) {
return NONE_MATCHER;
}
@@ -185,7 +185,7 @@ public abstract class StrMatcher {
* @param chars the characters to match, null or empty matches nothing
* @return a new Matcher for the given characters
*/
- public static StrMatcher charSetMatcher(String chars) {
+ public static StrMatcher charSetMatcher(final String chars) {
if (chars == null || chars.length() == 0) {
return NONE_MATCHER;
}
@@ -201,7 +201,7 @@ public abstract class StrMatcher {
* @param str the string to match, null or empty matches nothing
* @return a new Matcher for the given String
*/
- public static StrMatcher stringMatcher(String str) {
+ public static StrMatcher stringMatcher(final String str) {
if (str == null || str.length() == 0) {
return NONE_MATCHER;
}
@@ -255,7 +255,7 @@ public abstract class StrMatcher {
* @return the number of matching characters, zero for no match
* @since 2.4
*/
- public int isMatch(char[] buffer, int pos) {
+ public int isMatch(final char[] buffer, final int pos) {
return isMatch(buffer, pos, 0, buffer.length);
}
@@ -272,7 +272,7 @@ public abstract class StrMatcher {
*
* @param chars the characters to match, must not be null
*/
- CharSetMatcher(char[] chars) {
+ CharSetMatcher(final char[] chars) {
super();
this.chars = chars.clone();
Arrays.sort(this.chars);
@@ -288,7 +288,7 @@ public abstract class StrMatcher {
* @return the number of matching characters, zero for no match
*/
@Override
- public int isMatch(char[] buffer, int pos, int bufferStart, int bufferEnd) {
+ public int isMatch(final char[] buffer, final int pos, final int bufferStart, final int bufferEnd) {
return Arrays.binarySearch(chars, buffer[pos]) >= 0 ? 1 : 0;
}
}
@@ -306,7 +306,7 @@ public abstract class StrMatcher {
*
* @param ch the character to match
*/
- CharMatcher(char ch) {
+ CharMatcher(final char ch) {
super();
this.ch = ch;
}
@@ -321,7 +321,7 @@ public abstract class StrMatcher {
* @return the number of matching characters, zero for no match
*/
@Override
- public int isMatch(char[] buffer, int pos, int bufferStart, int bufferEnd) {
+ public int isMatch(final char[] buffer, final int pos, final int bufferStart, final int bufferEnd) {
return ch == buffer[pos] ? 1 : 0;
}
}
@@ -339,7 +339,7 @@ public abstract class StrMatcher {
*
* @param str the string to match, must not be null
*/
- StringMatcher(String str) {
+ StringMatcher(final String str) {
super();
chars = str.toCharArray();
}
@@ -354,8 +354,8 @@ public abstract class StrMatcher {
* @return the number of matching characters, zero for no match
*/
@Override
- public int isMatch(char[] buffer, int pos, int bufferStart, int bufferEnd) {
- int len = chars.length;
+ public int isMatch(final char[] buffer, int pos, final int bufferStart, final int bufferEnd) {
+ final int len = chars.length;
if (pos + len > bufferEnd) {
return 0;
}
@@ -391,7 +391,7 @@ public abstract class StrMatcher {
* @return the number of matching characters, zero for no match
*/
@Override
- public int isMatch(char[] buffer, int pos, int bufferStart, int bufferEnd) {
+ public int isMatch(final char[] buffer, final int pos, final int bufferStart, final int bufferEnd) {
return 0;
}
}
@@ -419,7 +419,7 @@ public abstract class StrMatcher {
* @return the number of matching characters, zero for no match
*/
@Override
- public int isMatch(char[] buffer, int pos, int bufferStart, int bufferEnd) {
+ public int isMatch(final char[] buffer, final int pos, final int bufferStart, final int bufferEnd) {
return buffer[pos] <= ' ' ? 1 : 0;
}
}
Modified: logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/lookup/StrSubstitutor.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/lookup/StrSubstitutor.java?rev=1419697&r1=1419696&r2=1419697&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/lookup/StrSubstitutor.java (original)
+++ logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/lookup/StrSubstitutor.java Mon Dec 10 19:36:06 2012
@@ -154,7 +154,7 @@ public class StrSubstitutor {
* @param <V> The type of object contained in the Map.
* @param valueMap the map with the variables' values, may be null
*/
- public <V> StrSubstitutor(Map<String, V> valueMap) {
+ public <V> StrSubstitutor(final Map<String, V> valueMap) {
this(new MapLookup(valueMap), DEFAULT_PREFIX, DEFAULT_SUFFIX, DEFAULT_ESCAPE);
}
@@ -167,7 +167,7 @@ public class StrSubstitutor {
* @param suffix the suffix for variables, not null
* @throws IllegalArgumentException if the prefix or suffix is null
*/
- public <V> StrSubstitutor(Map<String, V> valueMap, String prefix, String suffix) {
+ public <V> StrSubstitutor(final Map<String, V> valueMap, final String prefix, final String suffix) {
this(new MapLookup(valueMap), prefix, suffix, DEFAULT_ESCAPE);
}
@@ -181,7 +181,7 @@ public class StrSubstitutor {
* @param escape the escape character
* @throws IllegalArgumentException if the prefix or suffix is null
*/
- public <V> StrSubstitutor(Map<String, V> valueMap, String prefix, String suffix, char escape) {
+ public <V> StrSubstitutor(final Map<String, V> valueMap, final String prefix, final String suffix, final char escape) {
this(new MapLookup(valueMap), prefix, suffix, escape);
}
@@ -190,7 +190,7 @@ public class StrSubstitutor {
*
* @param variableResolver the variable resolver, may be null
*/
- public StrSubstitutor(StrLookup<?> variableResolver) {
+ public StrSubstitutor(final StrLookup<?> variableResolver) {
this(variableResolver, DEFAULT_PREFIX, DEFAULT_SUFFIX, DEFAULT_ESCAPE);
}
@@ -203,7 +203,7 @@ public class StrSubstitutor {
* @param escape the escape character
* @throws IllegalArgumentException if the prefix or suffix is null
*/
- public StrSubstitutor(StrLookup<?> variableResolver, String prefix, String suffix, char escape) {
+ public StrSubstitutor(final StrLookup<?> variableResolver, final String prefix, final String suffix, final char escape) {
this.setVariableResolver(variableResolver);
this.setVariablePrefix(prefix);
this.setVariableSuffix(suffix);
@@ -219,8 +219,8 @@ public class StrSubstitutor {
* @param escape the escape character
* @throws IllegalArgumentException if the prefix or suffix is null
*/
- public StrSubstitutor(StrLookup<?> variableResolver, StrMatcher prefixMatcher, StrMatcher suffixMatcher,
- char escape) {
+ public StrSubstitutor(final StrLookup<?> variableResolver, final StrMatcher prefixMatcher, final StrMatcher suffixMatcher,
+ final char escape) {
this.setVariableResolver(variableResolver);
this.setVariablePrefixMatcher(prefixMatcher);
this.setVariableSuffixMatcher(suffixMatcher);
@@ -236,7 +236,7 @@ public class StrSubstitutor {
* @param valueMap the map with the values, may be null
* @return the result of the replace operation
*/
- public static <V> String replace(Object source, Map<String, V> valueMap) {
+ public static <V> String replace(final Object source, final Map<String, V> valueMap) {
return new StrSubstitutor(valueMap).replace(source);
}
@@ -253,7 +253,7 @@ public class StrSubstitutor {
* @return the result of the replace operation
* @throws IllegalArgumentException if the prefix or suffix is null
*/
- public static <V> String replace(Object source, Map<String, V> valueMap, String prefix, String suffix) {
+ public static <V> String replace(final Object source, final Map<String, V> valueMap, final String prefix, final String suffix) {
return new StrSubstitutor(valueMap, prefix, suffix).replace(source);
}
@@ -265,15 +265,15 @@ public class StrSubstitutor {
* @param valueProperties the properties with values, may be null
* @return the result of the replace operation
*/
- public static String replace(Object source, Properties valueProperties) {
+ public static String replace(final Object source, final Properties valueProperties) {
if (valueProperties == null) {
return source.toString();
}
- Map<String, String> valueMap = new HashMap<String, String>();
- Enumeration<?> propNames = valueProperties.propertyNames();
+ final Map<String, String> valueMap = new HashMap<String, String>();
+ final Enumeration<?> propNames = valueProperties.propertyNames();
while (propNames.hasMoreElements()) {
- String propName = (String) propNames.nextElement();
- String propValue = valueProperties.getProperty(propName);
+ final String propName = (String) propNames.nextElement();
+ final String propValue = valueProperties.getProperty(propName);
valueMap.put(propName, propValue);
}
return StrSubstitutor.replace(source, valueMap);
@@ -287,7 +287,7 @@ public class StrSubstitutor {
* @param source the string to replace in, null returns null
* @return the result of the replace operation
*/
- public String replace(String source) {
+ public String replace(final String source) {
return replace(null, source);
}
//-----------------------------------------------------------------------
@@ -299,11 +299,11 @@ public class StrSubstitutor {
* @param source the string to replace in, null returns null
* @return the result of the replace operation
*/
- public String replace(LogEvent event, String source) {
+ public String replace(final LogEvent event, final String source) {
if (source == null) {
return null;
}
- StringBuilder buf = new StringBuilder(source);
+ final StringBuilder buf = new StringBuilder(source);
if (!substitute(event, buf, 0, source.length())) {
return source;
}
@@ -322,7 +322,7 @@ public class StrSubstitutor {
* @param length the length within the array to be processed, must be valid
* @return the result of the replace operation
*/
- public String replace(String source, int offset, int length) {
+ public String replace(final String source, final int offset, final int length) {
return replace(null, source, offset, length);
}
@@ -339,11 +339,11 @@ public class StrSubstitutor {
* @param length the length within the array to be processed, must be valid
* @return the result of the replace operation
*/
- public String replace(LogEvent event, String source, int offset, int length) {
+ public String replace(final LogEvent event, final String source, final int offset, final int length) {
if (source == null) {
return null;
}
- StringBuilder buf = new StringBuilder(length).append(source, offset, length);
+ final StringBuilder buf = new StringBuilder(length).append(source, offset, length);
if (!substitute(event, buf, 0, length)) {
return source.substring(offset, offset + length);
}
@@ -359,7 +359,7 @@ public class StrSubstitutor {
* @param source the character array to replace in, not altered, null returns null
* @return the result of the replace operation
*/
- public String replace(char[] source) {
+ public String replace(final char[] source) {
return replace(null, source);
}
@@ -373,11 +373,11 @@ public class StrSubstitutor {
* @param source the character array to replace in, not altered, null returns null
* @return the result of the replace operation
*/
- public String replace(LogEvent event, char[] source) {
+ public String replace(final LogEvent event, final char[] source) {
if (source == null) {
return null;
}
- StringBuilder buf = new StringBuilder(source.length).append(source);
+ final StringBuilder buf = new StringBuilder(source.length).append(source);
substitute(event, buf, 0, source.length);
return buf.toString();
}
@@ -395,7 +395,7 @@ public class StrSubstitutor {
* @param length the length within the array to be processed, must be valid
* @return the result of the replace operation
*/
- public String replace(char[] source, int offset, int length) {
+ public String replace(final char[] source, final int offset, final int length) {
return replace(null, source, offset, length);
}
@@ -413,11 +413,11 @@ public class StrSubstitutor {
* @param length the length within the array to be processed, must be valid
* @return the result of the replace operation
*/
- public String replace(LogEvent event, char[] source, int offset, int length) {
+ public String replace(final LogEvent event, final char[] source, final int offset, final int length) {
if (source == null) {
return null;
}
- StringBuilder buf = new StringBuilder(length).append(source, offset, length);
+ final StringBuilder buf = new StringBuilder(length).append(source, offset, length);
substitute(event, buf, 0, length);
return buf.toString();
}
@@ -431,7 +431,7 @@ public class StrSubstitutor {
* @param source the buffer to use as a template, not changed, null returns null
* @return the result of the replace operation
*/
- public String replace(StringBuffer source) {
+ public String replace(final StringBuffer source) {
return replace(null, source);
}
@@ -445,11 +445,11 @@ public class StrSubstitutor {
* @param source the buffer to use as a template, not changed, null returns null
* @return the result of the replace operation
*/
- public String replace(LogEvent event, StringBuffer source) {
+ public String replace(final LogEvent event, final StringBuffer source) {
if (source == null) {
return null;
}
- StringBuilder buf = new StringBuilder(source.length()).append(source);
+ final StringBuilder buf = new StringBuilder(source.length()).append(source);
substitute(event, buf, 0, buf.length());
return buf.toString();
}
@@ -467,7 +467,7 @@ public class StrSubstitutor {
* @param length the length within the array to be processed, must be valid
* @return the result of the replace operation
*/
- public String replace(StringBuffer source, int offset, int length) {
+ public String replace(final StringBuffer source, final int offset, final int length) {
return replace(null, source, offset, length);
}
@@ -485,11 +485,11 @@ public class StrSubstitutor {
* @param length the length within the array to be processed, must be valid
* @return the result of the replace operation
*/
- public String replace(LogEvent event, StringBuffer source, int offset, int length) {
+ public String replace(final LogEvent event, final StringBuffer source, final int offset, final int length) {
if (source == null) {
return null;
}
- StringBuilder buf = new StringBuilder(length).append(source, offset, length);
+ final StringBuilder buf = new StringBuilder(length).append(source, offset, length);
substitute(event, buf, 0, length);
return buf.toString();
}
@@ -503,7 +503,7 @@ public class StrSubstitutor {
* @param source the builder to use as a template, not changed, null returns null
* @return the result of the replace operation
*/
- public String replace(StringBuilder source) {
+ public String replace(final StringBuilder source) {
return replace(null, source);
}
@@ -517,11 +517,11 @@ public class StrSubstitutor {
* @param source the builder to use as a template, not changed, null returns null.
* @return the result of the replace operation.
*/
- public String replace(LogEvent event, StringBuilder source) {
+ public String replace(final LogEvent event, final StringBuilder source) {
if (source == null) {
return null;
}
- StringBuilder buf = new StringBuilder(source.length()).append(source);
+ final StringBuilder buf = new StringBuilder(source.length()).append(source);
substitute(event, buf, 0, buf.length());
return buf.toString();
}
@@ -538,7 +538,7 @@ public class StrSubstitutor {
* @param length the length within the array to be processed, must be valid
* @return the result of the replace operation
*/
- public String replace(StringBuilder source, int offset, int length) {
+ public String replace(final StringBuilder source, final int offset, final int length) {
return replace(null, source, offset, length);
}
@@ -556,11 +556,11 @@ public class StrSubstitutor {
* @param length the length within the array to be processed, must be valid
* @return the result of the replace operation
*/
- public String replace(LogEvent event, StringBuilder source, int offset, int length) {
+ public String replace(final LogEvent event, final StringBuilder source, final int offset, final int length) {
if (source == null) {
return null;
}
- StringBuilder buf = new StringBuilder(length).append(source, offset, length);
+ final StringBuilder buf = new StringBuilder(length).append(source, offset, length);
substitute(event, buf, 0, length);
return buf.toString();
}
@@ -574,7 +574,7 @@ public class StrSubstitutor {
* @param source the source to replace in, null returns null
* @return the result of the replace operation
*/
- public String replace(Object source) {
+ public String replace(final Object source) {
return replace(null, source);
}
//-----------------------------------------------------------------------
@@ -587,11 +587,11 @@ public class StrSubstitutor {
* @param source the source to replace in, null returns null
* @return the result of the replace operation
*/
- public String replace(LogEvent event, Object source) {
+ public String replace(final LogEvent event, final Object source) {
if (source == null) {
return null;
}
- StringBuilder buf = new StringBuilder().append(source);
+ final StringBuilder buf = new StringBuilder().append(source);
substitute(event, buf, 0, buf.length());
return buf.toString();
}
@@ -605,7 +605,7 @@ public class StrSubstitutor {
* @param source the buffer to replace in, updated, null returns zero
* @return true if altered
*/
- public boolean replaceIn(StringBuffer source) {
+ public boolean replaceIn(final StringBuffer source) {
if (source == null) {
return false;
}
@@ -625,7 +625,7 @@ public class StrSubstitutor {
* @param length the length within the buffer to be processed, must be valid
* @return true if altered
*/
- public boolean replaceIn(StringBuffer source, int offset, int length) {
+ public boolean replaceIn(final StringBuffer source, final int offset, final int length) {
return replaceIn(null, source, offset, length);
}
@@ -643,11 +643,11 @@ public class StrSubstitutor {
* @param length the length within the buffer to be processed, must be valid
* @return true if altered
*/
- public boolean replaceIn(LogEvent event, StringBuffer source, int offset, int length) {
+ public boolean replaceIn(final LogEvent event, final StringBuffer source, final int offset, final int length) {
if (source == null) {
return false;
}
- StringBuilder buf = new StringBuilder(length).append(source, offset, length);
+ final StringBuilder buf = new StringBuilder(length).append(source, offset, length);
if (!substitute(event, buf, 0, length)) {
return false;
}
@@ -663,7 +663,7 @@ public class StrSubstitutor {
* @param source the builder to replace in, updated, null returns zero
* @return true if altered
*/
- public boolean replaceIn(StringBuilder source) {
+ public boolean replaceIn(final StringBuilder source) {
return replaceIn(null, source);
}
@@ -676,7 +676,7 @@ public class StrSubstitutor {
* @param source the builder to replace in, updated, null returns zero
* @return true if altered
*/
- public boolean replaceIn(LogEvent event, StringBuilder source) {
+ public boolean replaceIn(final LogEvent event, final StringBuilder source) {
if (source == null) {
return false;
}
@@ -694,7 +694,7 @@ public class StrSubstitutor {
* @param length the length within the builder to be processed, must be valid
* @return true if altered
*/
- public boolean replaceIn(StringBuilder source, int offset, int length) {
+ public boolean replaceIn(final StringBuilder source, final int offset, final int length) {
return replaceIn(null, source, offset, length);
}
@@ -711,7 +711,7 @@ public class StrSubstitutor {
* @param length the length within the builder to be processed, must be valid
* @return true if altered
*/
- public boolean replaceIn(LogEvent event, StringBuilder source, int offset, int length) {
+ public boolean replaceIn(final LogEvent event, final StringBuilder source, final int offset, final int length) {
if (source == null) {
return false;
}
@@ -734,7 +734,7 @@ public class StrSubstitutor {
* @param length the length within the builder to be processed, must be valid
* @return true if altered
*/
- protected boolean substitute(LogEvent event, StringBuilder buf, int offset, int length) {
+ protected boolean substitute(final LogEvent event, final StringBuilder buf, final int offset, final int length) {
return substitute(event, buf, offset, length, null) > 0;
}
@@ -751,19 +751,19 @@ public class StrSubstitutor {
* @return the length change that occurs, unless priorVariables is null when the int
* represents a boolean flag as to whether any change occurred.
*/
- private int substitute(LogEvent event, StringBuilder buf, int offset, int length, List<String> priorVariables) {
- StrMatcher prefixMatcher = getVariablePrefixMatcher();
- StrMatcher suffixMatcher = getVariableSuffixMatcher();
- char escape = getEscapeChar();
+ private int substitute(final LogEvent event, final StringBuilder buf, final int offset, final int length, List<String> priorVariables) {
+ final StrMatcher prefixMatcher = getVariablePrefixMatcher();
+ final StrMatcher suffixMatcher = getVariableSuffixMatcher();
+ final char escape = getEscapeChar();
- boolean top = (priorVariables == null);
+ final boolean top = (priorVariables == null);
boolean altered = false;
int lengthChange = 0;
char[] chars = getChars(buf);
int bufEnd = offset + length;
int pos = offset;
while (pos < bufEnd) {
- int startMatchLen = prefixMatcher.isMatch(chars, pos, offset,
+ final int startMatchLen = prefixMatcher.isMatch(chars, pos, offset,
bufEnd);
if (startMatchLen == 0) {
pos++;
@@ -778,7 +778,7 @@ public class StrSubstitutor {
bufEnd--;
} else {
// find suffix
- int startPos = pos;
+ final int startPos = pos;
pos += startMatchLen;
int endMatchLen = 0;
int nestedVarCount = 0;
@@ -803,12 +803,12 @@ public class StrSubstitutor {
+ startMatchLen, pos - startPos
- startMatchLen);
if (isEnableSubstitutionInVariables()) {
- StringBuilder bufName = new StringBuilder(varName);
+ final StringBuilder bufName = new StringBuilder(varName);
substitute(event, bufName, 0, bufName.length());
varName = bufName.toString();
}
pos += endMatchLen;
- int endPos = pos;
+ final int endPos = pos;
// on the first call initialize priorVariables
if (priorVariables == null) {
@@ -822,11 +822,11 @@ public class StrSubstitutor {
priorVariables.add(varName);
// resolve the variable
- String varValue = resolveVariable(event, varName, buf,
+ final String varValue = resolveVariable(event, varName, buf,
startPos, endPos);
if (varValue != null) {
// recursive replace
- int varLen = varValue.length();
+ final int varLen = varValue.length();
buf.replace(startPos, endPos, varValue);
altered = true;
int change = substitute(event, buf, startPos,
@@ -865,11 +865,11 @@ public class StrSubstitutor {
* @param varName the variable name to check
* @param priorVariables the list of prior variables
*/
- private void checkCyclicSubstitution(String varName, List<String> priorVariables) {
+ private void checkCyclicSubstitution(final String varName, final List<String> priorVariables) {
if (!priorVariables.contains(varName)) {
return;
}
- StringBuilder buf = new StringBuilder(BUF_SIZE);
+ final StringBuilder buf = new StringBuilder(BUF_SIZE);
buf.append("Infinite loop in property interpolation of ");
buf.append(priorVariables.remove(0));
buf.append(": ");
@@ -895,9 +895,9 @@ public class StrSubstitutor {
* @param endPos the end position of the variable including the suffix, valid
* @return the variable's value or <b>null</b> if the variable is unknown
*/
- protected String resolveVariable(LogEvent event, String variableName, StringBuilder buf, int startPos,
- int endPos) {
- StrLookup<?> resolver = getVariableResolver();
+ protected String resolveVariable(final LogEvent event, final String variableName, final StringBuilder buf, final int startPos,
+ final int endPos) {
+ final StrLookup<?> resolver = getVariableResolver();
if (resolver == null) {
return null;
}
@@ -922,7 +922,7 @@ public class StrSubstitutor {
*
* @param escapeCharacter the escape character (0 for disabling escaping)
*/
- public void setEscapeChar(char escapeCharacter) {
+ public void setEscapeChar(final char escapeCharacter) {
this.escapeChar = escapeCharacter;
}
@@ -952,7 +952,7 @@ public class StrSubstitutor {
* @return this, to enable chaining
* @throws IllegalArgumentException if the prefix matcher is null
*/
- public StrSubstitutor setVariablePrefixMatcher(StrMatcher prefixMatcher) {
+ public StrSubstitutor setVariablePrefixMatcher(final StrMatcher prefixMatcher) {
if (prefixMatcher == null) {
throw new IllegalArgumentException("Variable prefix matcher must not be null!");
}
@@ -970,7 +970,7 @@ public class StrSubstitutor {
* @param prefix the prefix character to use
* @return this, to enable chaining
*/
- public StrSubstitutor setVariablePrefix(char prefix) {
+ public StrSubstitutor setVariablePrefix(final char prefix) {
return setVariablePrefixMatcher(StrMatcher.charMatcher(prefix));
}
@@ -984,7 +984,7 @@ public class StrSubstitutor {
* @return this, to enable chaining
* @throws IllegalArgumentException if the prefix is null
*/
- public StrSubstitutor setVariablePrefix(String prefix) {
+ public StrSubstitutor setVariablePrefix(final String prefix) {
if (prefix == null) {
throw new IllegalArgumentException("Variable prefix must not be null!");
}
@@ -1017,7 +1017,7 @@ public class StrSubstitutor {
* @return this, to enable chaining
* @throws IllegalArgumentException if the suffix matcher is null
*/
- public StrSubstitutor setVariableSuffixMatcher(StrMatcher suffixMatcher) {
+ public StrSubstitutor setVariableSuffixMatcher(final StrMatcher suffixMatcher) {
if (suffixMatcher == null) {
throw new IllegalArgumentException("Variable suffix matcher must not be null!");
}
@@ -1035,7 +1035,7 @@ public class StrSubstitutor {
* @param suffix the suffix character to use
* @return this, to enable chaining
*/
- public StrSubstitutor setVariableSuffix(char suffix) {
+ public StrSubstitutor setVariableSuffix(final char suffix) {
return setVariableSuffixMatcher(StrMatcher.charMatcher(suffix));
}
@@ -1049,7 +1049,7 @@ public class StrSubstitutor {
* @return this, to enable chaining
* @throws IllegalArgumentException if the suffix is null
*/
- public StrSubstitutor setVariableSuffix(String suffix) {
+ public StrSubstitutor setVariableSuffix(final String suffix) {
if (suffix == null) {
throw new IllegalArgumentException("Variable suffix must not be null!");
}
@@ -1072,7 +1072,7 @@ public class StrSubstitutor {
*
* @param variableResolver the VariableResolver
*/
- public void setVariableResolver(StrLookup<?> variableResolver) {
+ public void setVariableResolver(final StrLookup<?> variableResolver) {
this.variableResolver = variableResolver;
}
@@ -1095,12 +1095,12 @@ public class StrSubstitutor {
*
* @param enableSubstitutionInVariables the new value of the flag
*/
- public void setEnableSubstitutionInVariables(boolean enableSubstitutionInVariables) {
+ public void setEnableSubstitutionInVariables(final boolean enableSubstitutionInVariables) {
this.enableSubstitutionInVariables = enableSubstitutionInVariables;
}
- private char[] getChars(StringBuilder sb) {
- char[] chars = new char[sb.length()];
+ private char[] getChars(final StringBuilder sb) {
+ final char[] chars = new char[sb.length()];
sb.getChars(0, sb.length(), chars, 0);
return chars;
}
@@ -1114,10 +1114,10 @@ public class StrSubstitutor {
* @param iterable the iterable to append
* @param separator the separator to use, null means no separator
*/
- public void appendWithSeparators(StringBuilder sb, Iterable<?> iterable, String separator) {
+ public void appendWithSeparators(final StringBuilder sb, final Iterable<?> iterable, String separator) {
if (iterable != null) {
separator = (separator == null ? "" : separator);
- Iterator<?> it = iterable.iterator();
+ final Iterator<?> it = iterable.iterator();
while (it.hasNext()) {
sb.append(it.next());
if (it.hasNext()) {
Modified: logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/lookup/StructuredDataLookup.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/lookup/StructuredDataLookup.java?rev=1419697&r1=1419696&r2=1419697&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/lookup/StructuredDataLookup.java (original)
+++ logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/lookup/StructuredDataLookup.java Mon Dec 10 19:36:06 2012
@@ -31,7 +31,7 @@ public class StructuredDataLookup implem
* @param key the key to be looked up, may be null
* @return The value for the key.
*/
- public String lookup(String key) {
+ public String lookup(final String key) {
return null;
}
@@ -41,11 +41,11 @@ public class StructuredDataLookup implem
* @param key the key to be looked up, may be null
* @return The value associated with the key.
*/
- public String lookup(LogEvent event, String key) {
+ public String lookup(final LogEvent event, final String key) {
if (event == null || !(event.getMessage() instanceof StructuredDataMessage)) {
return null;
}
- StructuredDataMessage msg = (StructuredDataMessage) event.getMessage();
+ final StructuredDataMessage msg = (StructuredDataMessage) event.getMessage();
if (key.equalsIgnoreCase("id")) {
return msg.getId().getName();
} else if (key.equalsIgnoreCase("type")) {
Modified: logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/lookup/SystemPropertiesLookup.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/lookup/SystemPropertiesLookup.java?rev=1419697&r1=1419696&r2=1419697&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/lookup/SystemPropertiesLookup.java (original)
+++ logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/lookup/SystemPropertiesLookup.java Mon Dec 10 19:36:06 2012
@@ -30,7 +30,7 @@ public class SystemPropertiesLookup impl
* @param key the key to be looked up, may be null
* @return The value for the key.
*/
- public String lookup(String key) {
+ public String lookup(final String key) {
return System.getProperty(key);
}
@@ -40,7 +40,7 @@ public class SystemPropertiesLookup impl
* @param key the key to be looked up, may be null
* @return The value associated with the key.
*/
- public String lookup(LogEvent event, String key) {
+ public String lookup(final LogEvent event, final String key) {
return System.getProperty(key);
}
}
Modified: logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/net/AbstractJMSManager.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/net/AbstractJMSManager.java?rev=1419697&r1=1419696&r2=1419697&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/net/AbstractJMSManager.java (original)
+++ logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/net/AbstractJMSManager.java Mon Dec 10 19:36:06 2012
@@ -40,7 +40,7 @@ public abstract class AbstractJMSManager
* The Constructor.
* @param name The name of the Appender.
*/
- public AbstractJMSManager(String name) {
+ public AbstractJMSManager(final String name) {
super(name);
}
@@ -55,11 +55,11 @@ public abstract class AbstractJMSManager
* @return the InitialContext.
* @throws NamingException if a naming error occurs.
*/
- protected static Context createContext(String factoryName, String providerURL, String urlPkgPrefixes,
- String securityPrincipalName, String securityCredentials)
+ protected static Context createContext(final String factoryName, final String providerURL, final String urlPkgPrefixes,
+ final String securityPrincipalName, final String securityCredentials)
throws NamingException {
- Properties props = getEnvironment(factoryName, providerURL, urlPkgPrefixes, securityPrincipalName,
+ final Properties props = getEnvironment(factoryName, providerURL, urlPkgPrefixes, securityPrincipalName,
securityCredentials);
return new InitialContext(props);
}
@@ -71,10 +71,10 @@ public abstract class AbstractJMSManager
* @return The object to be located.
* @throws NamingException If an error occurs locating the name.
*/
- protected static Object lookup(Context ctx, String name) throws NamingException {
+ protected static Object lookup(final Context ctx, final String name) throws NamingException {
try {
return ctx.lookup(name);
- } catch (NameNotFoundException e) {
+ } catch (final NameNotFoundException e) {
LOGGER.warn("Could not find name [" + name + "].");
throw e;
}
@@ -90,9 +90,9 @@ public abstract class AbstractJMSManager
* @param securityCredentials The security credentials of the Principal.
* @return The Properties.
*/
- protected static Properties getEnvironment(String factoryName, String providerURL, String urlPkgPrefixes,
- String securityPrincipalName, String securityCredentials) {
- Properties props = new Properties();
+ protected static Properties getEnvironment(final String factoryName, final String providerURL, final String urlPkgPrefixes,
+ final String securityPrincipalName, final String securityCredentials) {
+ final Properties props = new Properties();
if (factoryName != null) {
props.put(Context.INITIAL_CONTEXT_FACTORY, factoryName);
if (providerURL != null) {
@@ -132,7 +132,7 @@ public abstract class AbstractJMSManager
* @param producer The MessageProducer.
* @throws Exception if an error occurs.
*/
- public synchronized void send(Serializable object, Session session, MessageProducer producer) throws Exception {
+ public synchronized void send(final Serializable object, final Session session, final MessageProducer producer) throws Exception {
try {
Message msg;
if (object instanceof String) {
@@ -143,7 +143,7 @@ public abstract class AbstractJMSManager
((ObjectMessage) msg).setObject(object);
}
producer.send(msg);
- } catch (JMSException ex) {
+ } catch (final JMSException ex) {
LOGGER.error("Could not publish message via JMS " + getName());
throw ex;
}
Modified: logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/net/AbstractJMSReceiver.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/net/AbstractJMSReceiver.java?rev=1419697&r1=1419696&r2=1419697&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/net/AbstractJMSReceiver.java (original)
+++ logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/net/AbstractJMSReceiver.java Mon Dec 10 19:36:06 2012
@@ -41,17 +41,17 @@ public abstract class AbstractJMSReceive
* Listener that receives the event.
* @param message The received message.
*/
- public void onMessage(javax.jms.Message message) {
+ public void onMessage(final javax.jms.Message message) {
try {
if (message instanceof ObjectMessage) {
- ObjectMessage objectMessage = (ObjectMessage) message;
+ final ObjectMessage objectMessage = (ObjectMessage) message;
log((LogEvent) objectMessage.getObject());
} else {
logger.warn("Received message is of type " + message.getJMSType()
+ ", was expecting ObjectMessage.");
}
- } catch (JMSException jmse) {
+ } catch (final JMSException jmse) {
logger.error("Exception thrown while processing incoming message.",
jmse);
}
@@ -64,10 +64,10 @@ public abstract class AbstractJMSReceive
* @return The object.
* @throws NamingException if an error occurs.
*/
- protected Object lookup(Context ctx, String name) throws NamingException {
+ protected Object lookup(final Context ctx, final String name) throws NamingException {
try {
return ctx.lookup(name);
- } catch (NameNotFoundException e) {
+ } catch (final NameNotFoundException e) {
logger.error("Could not find name [" + name + "].");
throw e;
}
Modified: logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/net/AbstractSocketManager.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/net/AbstractSocketManager.java?rev=1419697&r1=1419696&r2=1419697&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/net/AbstractSocketManager.java (original)
+++ logging/log4j/log4j2/trunk/core/src/main/java/org/apache/logging/log4j/core/net/AbstractSocketManager.java Mon Dec 10 19:36:06 2012
@@ -47,7 +47,7 @@ public abstract class AbstractSocketMana
* @param host The target host name.
* @param port The target port number.
*/
- public AbstractSocketManager(String name, OutputStream os, InetAddress addr, String host, int port) {
+ public AbstractSocketManager(final String name, final OutputStream os, final InetAddress addr, final String host, final int port) {
super(os, name);
this.address = addr;
this.host = host;