From 0bea1a6770a361820e7332766e10683a86687698 Mon Sep 17 00:00:00 2001 From: sebdet Date: Fri, 19 Jun 2020 17:27:03 +0200 Subject: Fix sonar issues Fix sonar/checkstyle issues in sdc code Issue-ID: SDC-3158 Signed-off-by: sebdet Change-Id: I0ae188c5f0e2d96fd94de66fe0dcd0c47bcd9af5 --- .../org/openecomp/sdc/asdctool/impl/RestUtils.java | 38 +++++++++------------- 1 file changed, 16 insertions(+), 22 deletions(-) (limited to 'asdctool/src/main/java') 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 httpResponse = HttpRequest.delete(url, headers); + Properties headers = new Properties(); + headers.put("USER_ID", adminUser); + try { + HttpResponse 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; + } } -- cgit 1.2.3-korg