diff options
author | Caolán McNamara <caolanm@redhat.com> | 2015-12-30 14:45:35 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2015-12-30 14:45:35 +0000 |
commit | bc353749e6be7906127e1f11b3802c462e19729c (patch) | |
tree | 5a45e43a8a454543610bfe9acbd439e1119a26dc /qadevOOo/runner | |
parent | 20cb57cde026c8cc6cf9470eb3100b6a884d864e (diff) |
coverity#1326978 SBSC: String concatenation in loop using + operator
Change-Id: I1e87d33d12b246aa071d28af3eec69bf79c7bf6f
Diffstat (limited to 'qadevOOo/runner')
-rw-r--r-- | qadevOOo/runner/util/DBTools.java | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/qadevOOo/runner/util/DBTools.java b/qadevOOo/runner/util/DBTools.java index 4fd764a49572..4410bf2a1cf6 100644 --- a/qadevOOo/runner/util/DBTools.java +++ b/qadevOOo/runner/util/DBTools.java @@ -322,36 +322,36 @@ public class DBTools { for(int i = 0; i < DBTools.TST_TABLE_VALUES.length; i++) { - String query = "insert into " + tbl_name + " values ("; + StringBuilder query = new StringBuilder("insert into " + tbl_name + " values ("); int j = 0; while(j < DBTools.TST_TABLE_VALUES[i].length) { if (j > 0) { - query += ", "; + query.append(", "); } Object value = DBTools.TST_TABLE_VALUES[i][j]; if (value instanceof String || value instanceof Date) { - query += "'"; + query.append("'"); } if (value instanceof Date) { Date date = (Date)value; - query += date.Year + "-" + date.Month + - "-" + date.Day; + query.append(date.Year).append("-").append(date.Month).append( + "-").append(date.Day); } else if (value instanceof Boolean) { - query += (((Boolean)value).booleanValue()) - ? "1" : "0"; + query.append((((Boolean)value).booleanValue()) + ? "1" : "0"); } else { - query += value; + query.append(value); } if (value instanceof String || value instanceof Date) { - query += "'"; + query.append("'"); } j++; } - query += ")"; - statement.executeUpdate(query); + query.append(")"); + statement.executeUpdate(query.toString()); } } |