diff options
author | fmallet <freddy.mallet@gmail.com> | 2010-09-09 08:59:00 +0000 |
---|---|---|
committer | fmallet <freddy.mallet@gmail.com> | 2010-09-09 08:59:00 +0000 |
commit | b2448a6bc0557803f85ad58e688ea9a0959b2a57 (patch) | |
tree | 6625006400c3862a7aa0e7dced5bc5c398a87118 /sonar-squid/src/main | |
parent | 0dd067a3efa7f4821fcc4643850b69ba8ac94137 (diff) | |
download | sonarqube-b2448a6bc0557803f85ad58e688ea9a0959b2a57.tar.gz sonarqube-b2448a6bc0557803f85ad58e688ea9a0959b2a57.zip |
The MessageFormat class must not be used to format check message when there isn't any parameter. Indeed, otherwise the message can't contain some patterns like "if(){".
Diffstat (limited to 'sonar-squid/src/main')
-rw-r--r-- | sonar-squid/src/main/java/org/sonar/squid/api/CheckMessage.java | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/sonar-squid/src/main/java/org/sonar/squid/api/CheckMessage.java b/sonar-squid/src/main/java/org/sonar/squid/api/CheckMessage.java index a8ce8ed8c17..425b26af8be 100644 --- a/sonar-squid/src/main/java/org/sonar/squid/api/CheckMessage.java +++ b/sonar-squid/src/main/java/org/sonar/squid/api/CheckMessage.java @@ -73,11 +73,15 @@ public class CheckMessage implements Message { @Override public String toString() { - return new ToStringBuilder(this).append("source", sourceCode).append("check", codeCheck).append("msg", defaultMessage).append("line", - line).toString(); + return new ToStringBuilder(this).append("source", sourceCode).append("check", codeCheck).append("msg", defaultMessage) + .append("line", line).toString(); } public String formatDefaultMessage() { - return MessageFormat.format(defaultMessage, messageArguments); + if (messageArguments.length == 0) { + return defaultMessage; + } else { + return MessageFormat.format(defaultMessage, messageArguments); + } } } |