diff options
author | Isaac Manuel Raj <isaac.manuelraj@huawei.com> | 2019-04-12 11:51:29 +0530 |
---|---|---|
committer | Isaac Manuel Raj <isaac.manuelraj@huawei.com> | 2019-04-12 11:51:29 +0530 |
commit | 861218e890065dc99d97be01903dcb3d302e77f4 (patch) | |
tree | 2e71752e1746af3f3e5c856f06172dffc379e758 | |
parent | e32315ad60357eeca4a00fa12f9108442fe11bb8 (diff) |
Code Enhancement (Sonar Fixes)
Sonar Issues Fixes
Issue-ID: SO-1490
Change-Id: Ic39ad72cb0176ccee3eeab79b51fe3df19d381c7
Signed-off-by: Isaac Manuel Raj <isaac.manuelraj@huawei.com>
3 files changed, 15 insertions, 44 deletions
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 <T> OpenStackResponse request(OpenStackRequest<T> 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> T execute(OpenStackRequest<T> 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 <R> OpenStackRequest<R> get(String path, Class<R> 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<R> { -// -// OpenStackRequest createRequest(OpenStackClient connector); -// -//} |