diff options
author | Caolán McNamara <caolanm@redhat.com> | 2015-12-30 13:46:41 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2015-12-30 13:46:41 +0000 |
commit | 5640826c0d5abb25681223eee4e632cf581ea160 (patch) | |
tree | aa95a699893a59e77cb0e0f4efe8031700f93088 /wizards/com | |
parent | e24683f321a10415d6f2afc870b2ab3fe6150789 (diff) |
coverity#1326995 SBSC: String concatenation in loop using + operator
Change-Id: I3e42e4815c7b03fdb7e9a4a1d260e4abfb7b6318
Diffstat (limited to 'wizards/com')
-rw-r--r-- | wizards/com/sun/star/wizards/db/SQLQueryComposer.java | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/wizards/com/sun/star/wizards/db/SQLQueryComposer.java b/wizards/com/sun/star/wizards/db/SQLQueryComposer.java index 7a99b7d1d0f8..e6e8c622f076 100644 --- a/wizards/com/sun/star/wizards/db/SQLQueryComposer.java +++ b/wizards/com/sun/star/wizards/db/SQLQueryComposer.java @@ -73,7 +73,7 @@ public class SQLQueryComposer getFromClause(); String sSelectBaseClause = "SELECT "; - String sSelectClause = sSelectBaseClause; + StringBuilder sb = new StringBuilder(sSelectBaseClause); for (int i = 0; i < CurDBMetaData.FieldColumns.length; i++) { if (addtoSelectClause(CurDBMetaData.FieldColumns[i].getDisplayFieldName())) @@ -81,23 +81,24 @@ public class SQLQueryComposer int iAggregate = CurDBMetaData.getAggregateIndex(CurDBMetaData.FieldColumns[i].getDisplayFieldName()); if (iAggregate > -1) { - sSelectClause += CurDBMetaData.AggregateFieldNames[iAggregate][1] + "(" + getComposedAliasDisplayName(CurDBMetaData.AggregateFieldNames[iAggregate][0]) + ")"; + sb.append(CurDBMetaData.AggregateFieldNames[iAggregate][1]).append("(").append(getComposedAliasDisplayName(CurDBMetaData.AggregateFieldNames[iAggregate][0])).append(")"); if (_baddAliasFieldNames) { - sSelectClause += getAliasFieldNameClause(CurDBMetaData.AggregateFieldNames[iAggregate][0]); + sb.append(getAliasFieldNameClause(CurDBMetaData.AggregateFieldNames[iAggregate][0])); } } else { - sSelectClause += getComposedAliasDisplayName(CurDBMetaData.FieldColumns[i].getDisplayFieldName()); + sb.append(getComposedAliasDisplayName(CurDBMetaData.FieldColumns[i].getDisplayFieldName())); if (_baddAliasFieldNames) { - sSelectClause += getAliasFieldNameClause(CurDBMetaData.FieldColumns[i].getDisplayFieldName()); + sb.append(getAliasFieldNameClause(CurDBMetaData.FieldColumns[i].getDisplayFieldName())); } } - sSelectClause += ", "; + sb.append(", "); } } + String sSelectClause = sb.toString(); // TODO: little bit unhandy version of remove the append 'comma' at the end if (sSelectClause.equals(sSelectBaseClause)) { |