diff options
author | Caolán McNamara <caolanm@redhat.com> | 2015-12-30 14:37:10 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2015-12-30 14:37:10 +0000 |
commit | 825caafe02256f40ef98cc828eeb35b2783444e3 (patch) | |
tree | c532c9ee9bfb7e4c6a3f8054713437ff86b97ca4 /qadevOOo/runner | |
parent | ccdd9f5a3ee239aed4d30ebd219992c49207a3b2 (diff) |
coverity#1326982 SBSC: String concatenation in loop using + operator
Change-Id: Ia8cff25ac8eb9539b81bdebe2aa52c324d70b357
Diffstat (limited to 'qadevOOo/runner')
-rw-r--r-- | qadevOOo/runner/util/utils.java | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/qadevOOo/runner/util/utils.java b/qadevOOo/runner/util/utils.java index 2ca7351db781..3acbb556cfd5 100644 --- a/qadevOOo/runner/util/utils.java +++ b/qadevOOo/runner/util/utils.java @@ -685,18 +685,19 @@ public class utils { appExecCommand = appExecCommand.replace("\"", ""); appExecCommand = appExecCommand.replace("'", ""); StringTokenizer commandTokens = new StringTokenizer(appExecCommand, " \t"); - String officeExecutable = ""; String officeExecCommand = "soffice"; + StringBuilder sb = new StringBuilder(); // is there a 'soffice' in the command? 2do: eliminate case sensitivity on windows int index = -1; while (commandTokens.hasMoreTokens() && index == -1) { - officeExecutable += commandTokens.nextToken() + " "; - index = officeExecutable.indexOf(officeExecCommand); + sb.append(commandTokens.nextToken()).append(" "); + index = sb.indexOf(officeExecCommand); } if (index == -1) { errorMessage = "Error: Your 'AppExecutionCommand' parameter does not " + "contain '" + officeExecCommand + "'."; } else { + String officeExecutable = sb.toString(); // does the directory exist? officeExecutable = officeExecutable.trim(); String officePath = officeExecutable.substring(0, index); |