diff options
author | mojahidi <mojahidul.islam@amdocs.com> | 2018-05-15 12:51:42 +0530 |
---|---|---|
committer | Vitaly Emporopulo <Vitaliy.Emporopulo@amdocs.com> | 2018-05-15 08:37:37 +0000 |
commit | 9559e131f086f6357987730fc0ad674aeb58f0a2 (patch) | |
tree | bc498da349be73bff050418ec8dd2c55291b6ed3 /openecomp-be/lib/openecomp-core-lib | |
parent | df247b4913b82af106e7e293d3f56dd427fb3cdd (diff) |
Removed logger.debug(, exception)
Removed logger.debug(, exception) from code
Change-Id: I27ace75d9e9a1d89e6e1c681531ea6dff46cb647
Issue-ID: SDC-836
Signed-off-by: mojahidi <mojahidul.islam@amdocs.com>
Diffstat (limited to 'openecomp-be/lib/openecomp-core-lib')
-rw-r--r-- | openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/main/java/org/openecomp/core/utilities/json/JsonUtil.java | 58 |
1 files changed, 23 insertions, 35 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 190eba16d6..92c590b5df 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 @@ -1,22 +1,18 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ +/* + * Copyright © 2018 European Support Limited + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * ============LICENSE_END========================================================= - */ +*/ package org.openecomp.core.utilities.json; @@ -26,34 +22,36 @@ import com.google.gson.JsonIOException; import com.google.gson.JsonParser; import com.google.gson.JsonSyntaxException; +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.Reader; +import java.io.StringReader; +import java.util.Collections; +import java.util.List; +import java.util.Set; +import java.util.stream.Collectors; + import org.apache.commons.collections4.CollectionUtils; import org.everit.json.schema.EnumSchema; import org.everit.json.schema.Schema; import org.everit.json.schema.ValidationException; import org.everit.json.schema.loader.SchemaLoader; import org.json.JSONObject; +import org.onap.sdc.tosca.datatypes.model.RequirementDefinition; import org.openecomp.core.utilities.CommonMethods; import org.openecomp.core.utilities.deserializers.RequirementDefinitionDeserializer; + import org.openecomp.sdc.logging.api.Logger; import org.openecomp.sdc.logging.api.LoggerFactory; -import org.onap.sdc.tosca.datatypes.model.RequirementDefinition; -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.Reader; -import java.io.StringReader; -import java.util.Collections; -import java.util.List; -import java.util.Set; -import java.util.stream.Collectors; /** * The type Json util. */ public class JsonUtil { - private static final Logger logger = LoggerFactory.getLogger(JsonUtil.class); + private static final Logger LOGGER = LoggerFactory.getLogger(JsonUtil.class); private static final GsonBuilder gsonBuilder; private static final Gson gson; @@ -118,21 +116,11 @@ public class JsonUtil { */ public static <T> T json2Object(InputStream is, Class<T> classOfT) { T type; - try { try (Reader br = new BufferedReader(new InputStreamReader(is))) { type = new Gson().fromJson(br, classOfT); } - } catch (JsonIOException | JsonSyntaxException | IOException exception) { + catch (JsonIOException | JsonSyntaxException | IOException exception) { throw new RuntimeException(exception); - } finally { - if (is != null) { - try { - is.close(); - } catch (IOException ignore) { - logger.debug("",ignore); - //do nothing - } - } } return type; } @@ -149,7 +137,7 @@ public class JsonUtil { try { return new JsonParser().parse(json).isJsonObject(); } catch (JsonSyntaxException jse) { - logger.debug("",jse); + LOGGER.error("Invalid json, Failed to parse json", jse); return false; } } @@ -186,7 +174,7 @@ public class JsonUtil { } private static List<ValidationException> validateUsingEverit(String json, String jsonSchema) { - logger.debug( + LOGGER.debug( String.format("validateUsingEverit start, json=%s, jsonSchema=%s", json, jsonSchema)); if (json == null || jsonSchema == null) { throw new IllegalArgumentException("Input strings json and jsonSchema can not be null"); |