Coverity fixed: #1351035 08/19208/4
Nikhil Goel [Tue, 21 Mar 2017 08:40:42 +0000 (13:40 +0530)]
Change-Id: If3d5ed072caee7633dd3d4c6fff92e550b7678bf

scilab/modules/gui/src/java/org/scilab/modules/gui/SwingViewWidget.java

index 4f96913..b826641 100644 (file)
@@ -39,6 +39,7 @@ import static org.scilab.modules.graphic_objects.graphicObject.GraphicObjectProp
 import java.awt.Color;
 import java.awt.Component;
 import java.awt.Font;
+import java.lang.StringBuilder;
 
 import javax.swing.JComponent;
 
@@ -251,11 +252,13 @@ public final class SwingViewWidget {
                 String[] tooltipString = ((String[]) value);
                 String tooltipText = tooltipString[0];
                 if (tooltipString.length > 1) {
-                    tooltipText = "<html>" + tooltipText;
+                    StringBuilder sb = new StringBuilder();
+                    sb.append("<html>" + tooltipText);
                     for (int kString = 1; kString < tooltipString.length; kString++) {
-                        tooltipText = tooltipText + "<br>" + tooltipString[kString];
+                        sb.append("<br>").append(tooltipString[kString]);
                     }
-                    tooltipText = tooltipText + "</html>";
+                    sb.append("</html>");
+                    tooltipText = sb.toString();
                 }
                 if (tooltipText.equals("")) {
                     uiControl.setToolTipText(null);