diff options
author | siddharth0905 <siddharth.singh4@amdocs.com> | 2018-01-08 14:36:29 +0530 |
---|---|---|
committer | Vitaly Emporopulo <Vitaliy.Emporopulo@amdocs.com> | 2018-01-09 13:19:10 +0000 |
commit | c9954d1b59d22d68aa731dad434e9989867a6157 (patch) | |
tree | 0a63f6648485b386139af6e220f6880245bab41e /openecomp-be/lib | |
parent | 785dc1ea36c8c333d93d9f54cae252d141319bfc (diff) |
Fix sonar issues - JsonUtil
Private constructor and Changed StringBuffer to StringBuilder
Change-Id: I5fdd520654c0ba00f54c66f2d4a96e60ee2b496e
Issue-ID: SDC-343
Signed-off-by: siddharth0905 <siddharth.singh4@amdocs.com>
Diffstat (limited to 'openecomp-be/lib')
-rw-r--r-- | openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/main/java/org/openecomp/core/utilities/json/JsonUtil.java | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/main/java/org/openecomp/core/utilities/json/JsonUtil.java b/openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/main/java/org/openecomp/core/utilities/json/JsonUtil.java index c3d32df447..413425d714 100644 --- a/openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/main/java/org/openecomp/core/utilities/json/JsonUtil.java +++ b/openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/main/java/org/openecomp/core/utilities/json/JsonUtil.java @@ -25,6 +25,7 @@ import com.google.gson.GsonBuilder; import com.google.gson.JsonIOException; import com.google.gson.JsonParser; import com.google.gson.JsonSyntaxException; + import org.apache.commons.collections4.CollectionUtils; import org.everit.json.schema.EnumSchema; import org.everit.json.schema.Schema; @@ -63,26 +64,28 @@ public class JsonUtil { gson = gsonBuilder.create(); } + private JsonUtil() { + } + /** * Object 2 json string. * * @param obj the obj * @return the string */ - //TODO: refactor all other ugly code to use this public static String object2Json(Object obj) { return sbObject2Json(obj).toString(); } /** - * Sb object 2 json string buffer. + * Sb object 2 json string builder. * * @param obj the obj - * @return the string buffer + * @return the string builder */ - public static StringBuffer sbObject2Json(Object obj) { - return new StringBuffer((new GsonBuilder()).setPrettyPrinting().create().toJson(obj)); + public static StringBuilder sbObject2Json(Object obj) { + return new StringBuilder(new GsonBuilder().setPrettyPrinting().create().toJson(obj)); } /** |