Multiple String Concatenations (MSC)

Description:

String classes are designed to be immutable, and every method in the class that appears to modify a String actually creates and returns a brand new String object containing the modification. The original String is left untouched, but the compiler can optimize your code.

Using StringBuffer instead of String for multiple mutable operations is better for performance. This audit helps you to find suspect code.

You can specify the maximum amount of concatenations allowed, and the scope to be analyzed during the audit.

Example:

private String getHtmlOut()  {
   String htmlOut;
   htmlOut = "<html>";
   ...
   htmlOut += "<body>";
   ...
   htmlOut += "The record not found";
   ...
   htmlOut += "</body></html>";
   return htmlOut;
}