From b2448a6bc0557803f85ad58e688ea9a0959b2a57 Mon Sep 17 00:00:00 2001 From: fmallet Date: Thu, 9 Sep 2010 08:59:00 +0000 Subject: 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(){". --- .../src/main/java/org/sonar/squid/api/CheckMessage.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'sonar-squid/src/main') 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); + } } } -- cgit v1.2.3