diff options
author | sebdet <sebastien.determe@intl.att.com> | 2020-06-19 17:27:03 +0200 |
---|---|---|
committer | Ofir Sonsino <ofir.sonsino@intl.att.com> | 2020-07-05 07:59:06 +0000 |
commit | 0bea1a6770a361820e7332766e10683a86687698 (patch) | |
tree | 6fa5e7ec20a6bdc3fc466cb80a25c6db2f33b1ad /asdctool/src/main/java/org | |
parent | e4092fe48f6dd74c778a03d84df00835d6ca0a3d (diff) |
Fix sonar issues
Fix sonar/checkstyle issues in sdc code
Issue-ID: SDC-3158
Signed-off-by: sebdet <sebastien.determe@intl.att.com>
Change-Id: I0ae188c5f0e2d96fd94de66fe0dcd0c47bcd9af5
Diffstat (limited to 'asdctool/src/main/java/org')
-rw-r--r-- | asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/RestUtils.java | 38 |
1 files changed, 16 insertions, 22 deletions
diff --git a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/RestUtils.java b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/RestUtils.java index 27ef49ac15..aaafdd2367 100644 --- a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/RestUtils.java +++ b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/RestUtils.java @@ -7,9 +7,9 @@ * 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. @@ -20,13 +20,12 @@ package org.openecomp.sdc.asdctool.impl; +import java.util.Properties; import org.apache.http.HttpStatus; import org.openecomp.sdc.common.http.client.api.HttpRequest; import org.openecomp.sdc.common.http.client.api.HttpResponse; import org.openecomp.sdc.common.log.wrappers.Logger; -import java.util.Properties; - /** * Created by mlando on 2/23/2016. */ @@ -34,31 +33,26 @@ public class RestUtils { static final String DELETE_PRODUCT = "http://%s:%s/sdc2/rest/v1/catalog/products/%s"; - private static Logger log = Logger.getLogger(RestUtils.class.getName()); + private static Logger log = Logger.getLogger(RestUtils.class.getName()); - public RestUtils() { - } + public Integer deleteProduct(String productUid, String beHost, String bePort, String adminUser) { + String url = String.format(DELETE_PRODUCT, beHost, bePort, productUid); - public Integer deleteProduct(String productUid, String beHost, String bePort, String adminUser) { - String url = String.format(DELETE_PRODUCT, beHost, bePort, productUid); - - Properties headers = new Properties(); - headers.put("USER_ID", adminUser); - try { - HttpResponse<String> httpResponse = HttpRequest.delete(url, headers); + Properties headers = new Properties(); + headers.put("USER_ID", adminUser); + try { + HttpResponse<String> httpResponse = HttpRequest.delete(url, headers); int status = httpResponse.getStatusCode(); if (status == HttpStatus.SC_OK) { log.debug("Product uid:{} successfully deleted", productUid); - } - else { + } else { log.error("Product uid:{} delete failed status {}", productUid, status); } return status; - } - catch(Exception e) { - log.error("Product uid:{} delete failed with exception",productUid, e); - } - return null; - } + } catch (Exception e) { + log.error("Product uid:{} delete failed with exception", productUid, e); + } + return null; + } } |