You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by gg...@apache.org on 2014/02/09 04:24:41 UTC
svn commit: r1566195 -
/logging/log4j/log4j2/trunk/log4j-api/src/main/java/org/apache/logging/log4j/message/ParameterizedMessage.java
Author: ggregory
Date: Sun Feb 9 03:24:40 2014
New Revision: 1566195
URL: http://svn.apache.org/r1566195
Log:
PMD: These nested if statements could be combined.
Modified:
logging/log4j/log4j2/trunk/log4j-api/src/main/java/org/apache/logging/log4j/message/ParameterizedMessage.java
Modified: logging/log4j/log4j2/trunk/log4j-api/src/main/java/org/apache/logging/log4j/message/ParameterizedMessage.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-api/src/main/java/org/apache/logging/log4j/message/ParameterizedMessage.java?rev=1566195&r1=1566194&r2=1566195&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/log4j-api/src/main/java/org/apache/logging/log4j/message/ParameterizedMessage.java (original)
+++ logging/log4j/log4j2/trunk/log4j-api/src/main/java/org/apache/logging/log4j/message/ParameterizedMessage.java Sun Feb 9 03:24:40 2014
@@ -265,34 +265,31 @@ public class ParameterizedMessage implem
if (curChar == ESCAPE_CHAR) {
escapeCounter++;
} else {
- if (curChar == DELIM_START) {
- if (i < messagePattern.length() - 1) {
- if (messagePattern.charAt(i + 1) == DELIM_STOP) {
- // write escaped escape chars
- final int escapedEscapes = escapeCounter / 2;
- for (int j = 0; j < escapedEscapes; j++) {
- result.append(ESCAPE_CHAR);
- }
+ if (curChar == DELIM_START && i < messagePattern.length() - 1
+ && messagePattern.charAt(i + 1) == DELIM_STOP) {
+ // write escaped escape chars
+ final int escapedEscapes = escapeCounter / 2;
+ for (int j = 0; j < escapedEscapes; j++) {
+ result.append(ESCAPE_CHAR);
+ }
- if (escapeCounter % 2 == 1) {
- // i.e. escaped
- // write escaped escape chars
- result.append(DELIM_START);
- result.append(DELIM_STOP);
- } else {
- // unescaped
- if (currentArgument < arguments.length) {
- result.append(arguments[currentArgument]);
- } else {
- result.append(DELIM_START).append(DELIM_STOP);
- }
- currentArgument++;
- }
- i++;
- escapeCounter = 0;
- continue;
+ if (escapeCounter % 2 == 1) {
+ // i.e. escaped
+ // write escaped escape chars
+ result.append(DELIM_START);
+ result.append(DELIM_STOP);
+ } else {
+ // unescaped
+ if (currentArgument < arguments.length) {
+ result.append(arguments[currentArgument]);
+ } else {
+ result.append(DELIM_START).append(DELIM_STOP);
}
+ currentArgument++;
}
+ i++;
+ escapeCounter = 0;
+ continue;
}
// any other char beside ESCAPE or DELIM_START/STOP-combo
// write unescaped escape chars