From 861218e890065dc99d97be01903dcb3d302e77f4 Mon Sep 17 00:00:00 2001 From: Isaac Manuel Raj Date: Fri, 12 Apr 2019 11:51:29 +0530 Subject: Code Enhancement (Sonar Fixes) Sonar Issues Fixes Issue-ID: SO-1490 Change-Id: Ic39ad72cb0176ccee3eeab79b51fe3df19d381c7 Signed-off-by: Isaac Manuel Raj --- .../base/client/OpenStackBaseException.java | 26 ++-------------------- .../openstack/base/client/OpenStackClient.java | 26 +++++++++++----------- .../openstack/base/client/OpenStackCommand.java | 7 ------ 3 files changed, 15 insertions(+), 44 deletions(-) (limited to 'openstack-client/src/main') diff --git a/openstack-client/src/main/java/com/woorea/openstack/base/client/OpenStackBaseException.java b/openstack-client/src/main/java/com/woorea/openstack/base/client/OpenStackBaseException.java index c852ecf..53d2595 100644 --- a/openstack-client/src/main/java/com/woorea/openstack/base/client/OpenStackBaseException.java +++ b/openstack-client/src/main/java/com/woorea/openstack/base/client/OpenStackBaseException.java @@ -14,28 +14,6 @@ * ============LICENSE_END========================================================= */ -/* - * ============LICENSE_START========================================== - * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. - * =================================================================== - * 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============================================ - * - * ECOMP and OpenECOMP are trademarks - * and service marks of AT&T Intellectual Property. - * - */ package com.woorea.openstack.base.client; @@ -51,7 +29,7 @@ public abstract class OpenStackBaseException extends RuntimeException * Implement only the basic constructors */ public OpenStackBaseException () {} - + public OpenStackBaseException(String message) { super(message); } @@ -59,4 +37,4 @@ public abstract class OpenStackBaseException extends RuntimeException public OpenStackBaseException(String message, Throwable cause) { super(message, cause); } -} +} \ No newline at end of file diff --git a/openstack-client/src/main/java/com/woorea/openstack/base/client/OpenStackClient.java b/openstack-client/src/main/java/com/woorea/openstack/base/client/OpenStackClient.java index 03d2b5c..23ee8dc 100644 --- a/openstack-client/src/main/java/com/woorea/openstack/base/client/OpenStackClient.java +++ b/openstack-client/src/main/java/com/woorea/openstack/base/client/OpenStackClient.java @@ -24,17 +24,17 @@ import java.util.Properties; import java.util.ServiceLoader; public class OpenStackClient { - + protected String endpoint; - + protected OpenStackTokenProvider tokenProvider; protected static int AUTHENTICATION_RETRIES = 1; protected OpenStackClientConnector connector; - + protected Properties properties = new Properties(); - + protected static OpenStackClientConnector DEFAULT_CONNECTOR; static { @@ -59,7 +59,7 @@ public class OpenStackClient { public OpenStackResponse request(OpenStackRequest request) { OpenStackResponseException authException = null; - //System.out.println("Openstack query:"+request.toString()); + for (int i = 0; i <= AUTHENTICATION_RETRIES; i++) { request.endpoint(endpoint); @@ -78,10 +78,10 @@ public class OpenStackClient { tokenProvider.expireToken(); } } - if(null == authException){ - authException = new OpenStackResponseException("Unknown issue",500); + if(null == authException){ + authException = new OpenStackResponseException("Unknown issue",500); } - throw authException; + throw authException; } public T execute(OpenStackRequest request) { @@ -92,17 +92,17 @@ public class OpenStackClient { public void property(String property, String value) { properties.put(property, value); } - + public void setTokenProvider(OpenStackTokenProvider tokenProvider) { this.tokenProvider = tokenProvider; } - + public void token(String token) { setTokenProvider(new OpenStackSimpleTokenProvider(token)); } - + public OpenStackRequest get(String path, Class returnType) { return new OpenStackRequest<>(this, HttpMethod.GET, path, null, returnType); } - -} + +} \ No newline at end of file diff --git a/openstack-client/src/main/java/com/woorea/openstack/base/client/OpenStackCommand.java b/openstack-client/src/main/java/com/woorea/openstack/base/client/OpenStackCommand.java index c66b548..db87a3b 100644 --- a/openstack-client/src/main/java/com/woorea/openstack/base/client/OpenStackCommand.java +++ b/openstack-client/src/main/java/com/woorea/openstack/base/client/OpenStackCommand.java @@ -15,10 +15,3 @@ */ package com.woorea.openstack.base.client; -//package org.openstack.base.client; -// -//public interface OpenStackCommand { -// -// OpenStackRequest createRequest(OpenStackClient connector); -// -//} -- cgit 1.2.3-korg