diff options
author | Abhishek Koneru <akoneru@redhat.com> | 2012-05-18 17:59:50 -0400 |
---|---|---|
committer | Ade Lee <alee@redhat.com> | 2012-05-24 23:09:10 -0400 |
commit | be23c86db27b7f66ca16a10ae3ef3f043d1d4b27 (patch) | |
tree | ba5ed1bbe24889b7d22278093ee66cffc780b42b /base/kra/src/com/netscape/kra/KeyRecoveryAuthority.java | |
parent | 9db76ed1d1f8969e93aaff320e49662f53688e2e (diff) | |
download | pki-be23c86db27b7f66ca16a10ae3ef3f043d1d4b27.tar.gz pki-be23c86db27b7f66ca16a10ae3ef3f043d1d4b27.tar.xz pki-be23c86db27b7f66ca16a10ae3ef3f043d1d4b27.zip |
Fixes for Coverity Defects of Category : FB.SBSC_USE_STRINGBUFFER_CONCATENATION --Remaining
Diffstat (limited to 'base/kra/src/com/netscape/kra/KeyRecoveryAuthority.java')
-rw-r--r-- | base/kra/src/com/netscape/kra/KeyRecoveryAuthority.java | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/base/kra/src/com/netscape/kra/KeyRecoveryAuthority.java b/base/kra/src/com/netscape/kra/KeyRecoveryAuthority.java index 6579261f6..8aebebad0 100644 --- a/base/kra/src/com/netscape/kra/KeyRecoveryAuthority.java +++ b/base/kra/src/com/netscape/kra/KeyRecoveryAuthority.java @@ -1666,16 +1666,16 @@ public class KeyRecoveryAuthority implements IAuthority, IKeyService, IKeyRecove // convert "rawData" into "base64Data" if (rawData != null) { String base64Data = CMS.BtoA(rawData).trim(); - String key = ""; + StringBuffer key = new StringBuffer(); // extract all line separators from the "base64Data" for (int i = 0; i < base64Data.length(); i++) { if (base64Data.substring(i, i).getBytes() != EOL) { - key += base64Data.substring(i, i); + key.append(base64Data.substring(i, i)); } } - return key; + return key.toString(); } return ILogger.SIGNED_AUDIT_EMPTY_VALUE; @@ -1710,7 +1710,7 @@ public class KeyRecoveryAuthority implements IAuthority, IKeyService, IKeyRecove } String key = null; - + StringBuffer tempBuffer = new StringBuffer(); // convert "rawData" into "base64Data" if (rawData != null) { String base64Data = null; @@ -1720,11 +1720,15 @@ public class KeyRecoveryAuthority implements IAuthority, IKeyService, IKeyRecove // extract all line separators from the "base64Data" for (int i = 0; i < base64Data.length(); i++) { if (base64Data.substring(i, i).getBytes() != EOL) { - key += base64Data.substring(i, i); + tempBuffer.append(base64Data.substring(i, i)); } } } + if (tempBuffer.length() > 0) { + key = tempBuffer.toString(); + } + if (key != null) { key = key.trim(); |