summaryrefslogtreecommitdiffstats
path: root/base/common/src/com/netscape/cmscore/dbs/DBRegistry.java
diff options
context:
space:
mode:
authorAbhishek Koneru <akoneru@redhat.com>2012-05-18 16:12:17 -0400
committerAde Lee <alee@redhat.com>2012-05-24 23:08:51 -0400
commit9db76ed1d1f8969e93aaff320e49662f53688e2e (patch)
tree2e7af87ca0f72cdf4eb982764757d2884b21ce7b /base/common/src/com/netscape/cmscore/dbs/DBRegistry.java
parenta4db0f39e257950a5c89203452c1184c7080e5bd (diff)
downloadpki-9db76ed1d1f8969e93aaff320e49662f53688e2e.tar.gz
pki-9db76ed1d1f8969e93aaff320e49662f53688e2e.tar.xz
pki-9db76ed1d1f8969e93aaff320e49662f53688e2e.zip
Fixes for Coverity Defects of Category : FB.SBSC_USE_STRINGBUFFER_CONCATENATION
Diffstat (limited to 'base/common/src/com/netscape/cmscore/dbs/DBRegistry.java')
-rw-r--r--base/common/src/com/netscape/cmscore/dbs/DBRegistry.java30
1 files changed, 16 insertions, 14 deletions
diff --git a/base/common/src/com/netscape/cmscore/dbs/DBRegistry.java b/base/common/src/com/netscape/cmscore/dbs/DBRegistry.java
index 5169bc4c9..250ebf394 100644
--- a/base/common/src/com/netscape/cmscore/dbs/DBRegistry.java
+++ b/base/common/src/com/netscape/cmscore/dbs/DBRegistry.java
@@ -262,12 +262,20 @@ public class DBRegistry implements IDBRegistry, ISubsystem {
}
}
}
- String result = "";
+ return inStringFormat(v);
+ }
+ /**
+ * Convert a Vector<String> to Concatenated String
+ * @param v
+ * @return
+ */
+ private String inStringFormat(Vector<String> v){
+ StringBuffer result = new StringBuffer();
for (int i = 0; i < v.size(); i++) {
- result += v.elementAt(i);
+ result.append(v.elementAt(i));
}
- return result;
+ return result.toString();
}
/**
@@ -321,13 +329,13 @@ public class DBRegistry implements IDBRegistry, ISubsystem {
if (ldapNames == null)
throw new EDBException(
CMS.getUserMessage("CMS_DBS_INVALID_FILTER_ITEM", f));
- String filter = "";
+ StringBuffer filter = new StringBuffer();
for (int g = 0; g < ldapNames.length; g++) {
- filter += "(objectclass=" +
- ldapNames[g] + ")";
+ filter.append("(objectclass=" +
+ ldapNames[g] + ")");
}
- return "&" + filter;
+ return "&" + filter.toString();
} else {
return c.convert(type, "=", value);
}
@@ -526,13 +534,7 @@ public class DBRegistry implements IDBRegistry, ISubsystem {
v.addElement(s[i]);
}
- // concate them
- String result = "";
-
- for (int i = 0; i < v.size(); i++) {
- result += v.elementAt(i) + "+";
- }
- return result;
+ return inStringFormat(v);
}
}