From fbb02159b84435cf37221ae8ae5e0045167be15a Mon Sep 17 00:00:00 2001 From: Fiete Ostkamp Date: Mon, 7 Nov 2022 08:35:37 +0000 Subject: Reduce the number of problems in aai-common by removing unused imports - run mvn spotless:apply across aai-commmon to remove unused imports - run mvn formatter:format across aai-common Issue-ID: AAI-3583 Signed-off-by: Fiete Ostkamp Change-Id: I2dfeb395eafa2824ce8369bba3a18db3e1845522 --- .../main/java/org/onap/aai/restclient/AAIRestClient.java | 5 ++--- .../java/org/onap/aai/restclient/NoAuthRestClient.java | 10 ++++------ .../org/onap/aai/restclient/OneWaySSLRestClient.java | 16 +++++++--------- .../aai/restclient/PropertyPasswordConfiguration.java | 7 +++++-- .../main/java/org/onap/aai/restclient/RestClient.java | 5 ++--- .../aai/restclient/RestClientResponseErrorHandler.java | 5 ++--- .../org/onap/aai/restclient/TwoWaySSLRestClient.java | 14 ++++++-------- 7 files changed, 28 insertions(+), 34 deletions(-) (limited to 'aai-rest/src') diff --git a/aai-rest/src/main/java/org/onap/aai/restclient/AAIRestClient.java b/aai-rest/src/main/java/org/onap/aai/restclient/AAIRestClient.java index 3470de9d..05d5ec0f 100644 --- a/aai-rest/src/main/java/org/onap/aai/restclient/AAIRestClient.java +++ b/aai-rest/src/main/java/org/onap/aai/restclient/AAIRestClient.java @@ -20,12 +20,11 @@ package org.onap.aai.restclient; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - import java.util.Collections; import java.util.Map; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Value; import org.springframework.http.HttpHeaders; import org.springframework.http.MediaType; diff --git a/aai-rest/src/main/java/org/onap/aai/restclient/NoAuthRestClient.java b/aai-rest/src/main/java/org/onap/aai/restclient/NoAuthRestClient.java index b11b0333..b5585460 100644 --- a/aai-rest/src/main/java/org/onap/aai/restclient/NoAuthRestClient.java +++ b/aai-rest/src/main/java/org/onap/aai/restclient/NoAuthRestClient.java @@ -20,18 +20,16 @@ package org.onap.aai.restclient; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; +import javax.annotation.PostConstruct; + import org.apache.http.client.HttpClient; import org.apache.http.impl.client.HttpClients; import org.onap.aai.aailog.filter.RestClientLoggingInterceptor; -import org.springframework.boot.web.client.RestTemplateBuilder; -import org.springframework.http.client.ClientHttpRequestFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; import org.springframework.web.client.RestTemplate; -import javax.annotation.PostConstruct; - public abstract class NoAuthRestClient extends RestClient { private static Logger logger = LoggerFactory.getLogger(NoAuthRestClient.class); diff --git a/aai-rest/src/main/java/org/onap/aai/restclient/OneWaySSLRestClient.java b/aai-rest/src/main/java/org/onap/aai/restclient/OneWaySSLRestClient.java index 5c359e27..614f6770 100644 --- a/aai-rest/src/main/java/org/onap/aai/restclient/OneWaySSLRestClient.java +++ b/aai-rest/src/main/java/org/onap/aai/restclient/OneWaySSLRestClient.java @@ -20,20 +20,19 @@ package org.onap.aai.restclient; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; +import javax.annotation.PostConstruct; +import javax.net.ssl.SSLContext; + import org.apache.http.client.HttpClient; import org.apache.http.impl.client.HttpClients; import org.apache.http.ssl.SSLContextBuilder; import org.onap.aai.aailog.filter.RestClientLoggingInterceptor; -import org.springframework.boot.web.client.RestTemplateBuilder; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; import org.springframework.util.ResourceUtils; import org.springframework.web.client.RestTemplate; -import javax.annotation.PostConstruct; -import javax.net.ssl.SSLContext; - public abstract class OneWaySSLRestClient extends RestClient { private static Logger logger = LoggerFactory.getLogger(OneWaySSLRestClient.class); @@ -61,12 +60,11 @@ public abstract class OneWaySSLRestClient extends RestClient { String trustStore = getTruststorePath(); - SSLContext sslContext = - SSLContextBuilder.create() + SSLContext sslContext = SSLContextBuilder.create() .loadTrustMaterial(ResourceUtils.getFile(trustStore), trustStorePassword).build(); HttpClient client = - HttpClients.custom().setSSLContext(sslContext).setSSLHostnameVerifier((s, sslSession) -> true).build(); + HttpClients.custom().setSSLContext(sslContext).setSSLHostnameVerifier((s, sslSession) -> true).build(); return client; } diff --git a/aai-rest/src/main/java/org/onap/aai/restclient/PropertyPasswordConfiguration.java b/aai-rest/src/main/java/org/onap/aai/restclient/PropertyPasswordConfiguration.java index 47dd2f2d..9ed35def 100644 --- a/aai-rest/src/main/java/org/onap/aai/restclient/PropertyPasswordConfiguration.java +++ b/aai-rest/src/main/java/org/onap/aai/restclient/PropertyPasswordConfiguration.java @@ -17,6 +17,7 @@ * limitations under the License. * ============LICENSE_END========================================================= */ + package org.onap.aai.restclient; import java.io.File; @@ -117,7 +118,8 @@ public class PropertyPasswordConfiguration implements ApplicationContextInitiali Map propertyOverrides = new LinkedHashMap<>(); decodePasswords(propertySource, propertyOverrides); if (!propertyOverrides.isEmpty()) { - PropertySource decodedProperties = new MapPropertySource("decoded "+ propertySource.getName(), propertyOverrides); + PropertySource decodedProperties = + new MapPropertySource("decoded " + propertySource.getName(), propertyOverrides); environment.getPropertySources().addBefore(propertySource.getName(), decodedProperties); } @@ -143,7 +145,8 @@ public class PropertyPasswordConfiguration implements ApplicationContextInitiali } private String decodePasswordsInString(String input) { - if (input == null) return null; + if (input == null) + return null; StringBuffer output = new StringBuffer(); Matcher matcher = decodePasswordPattern.matcher(input); while (matcher.find()) { diff --git a/aai-rest/src/main/java/org/onap/aai/restclient/RestClient.java b/aai-rest/src/main/java/org/onap/aai/restclient/RestClient.java index 67fb01e1..6fd2ab60 100644 --- a/aai-rest/src/main/java/org/onap/aai/restclient/RestClient.java +++ b/aai-rest/src/main/java/org/onap/aai/restclient/RestClient.java @@ -22,13 +22,12 @@ package org.onap.aai.restclient; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - import java.net.URI; import java.net.URISyntaxException; import java.util.Map; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Value; import org.springframework.core.io.Resource; import org.springframework.http.HttpEntity; diff --git a/aai-rest/src/main/java/org/onap/aai/restclient/RestClientResponseErrorHandler.java b/aai-rest/src/main/java/org/onap/aai/restclient/RestClientResponseErrorHandler.java index 9945275a..fdf1a1ce 100644 --- a/aai-rest/src/main/java/org/onap/aai/restclient/RestClientResponseErrorHandler.java +++ b/aai-rest/src/main/java/org/onap/aai/restclient/RestClientResponseErrorHandler.java @@ -20,11 +20,10 @@ package org.onap.aai.restclient; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - import java.io.IOException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.http.HttpStatus; import org.springframework.http.client.ClientHttpResponse; import org.springframework.web.client.ResponseErrorHandler; diff --git a/aai-rest/src/main/java/org/onap/aai/restclient/TwoWaySSLRestClient.java b/aai-rest/src/main/java/org/onap/aai/restclient/TwoWaySSLRestClient.java index f43d21c8..5ea4fc33 100644 --- a/aai-rest/src/main/java/org/onap/aai/restclient/TwoWaySSLRestClient.java +++ b/aai-rest/src/main/java/org/onap/aai/restclient/TwoWaySSLRestClient.java @@ -20,9 +20,6 @@ package org.onap.aai.restclient; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - import java.io.File; import java.io.FileInputStream; import java.io.InputStream; @@ -34,11 +31,12 @@ import javax.net.ssl.SSLContext; import org.apache.http.client.HttpClient; import org.apache.http.impl.client.HttpClients; import org.apache.http.ssl.SSLContextBuilder; -import org.springframework.boot.web.client.RestTemplateBuilder; +import org.onap.aai.aailog.filter.RestClientLoggingInterceptor; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; import org.springframework.util.ResourceUtils; import org.springframework.web.client.RestTemplate; -import org.onap.aai.aailog.filter.RestClientLoggingInterceptor; public abstract class TwoWaySSLRestClient extends RestClient { @@ -69,11 +67,11 @@ public abstract class TwoWaySSLRestClient extends RestClient { String trustStore = getTruststorePath(); SSLContext sslContext = - SSLContextBuilder.create().loadKeyMaterial(loadPfx(keyStore, keyStorePassword), keyStorePassword) - .loadTrustMaterial(ResourceUtils.getFile(trustStore), trustStorePassword).build(); + SSLContextBuilder.create().loadKeyMaterial(loadPfx(keyStore, keyStorePassword), keyStorePassword) + .loadTrustMaterial(ResourceUtils.getFile(trustStore), trustStorePassword).build(); HttpClient client = - HttpClients.custom().setSSLContext(sslContext).setSSLHostnameVerifier((s, sslSession) -> true).build(); + HttpClients.custom().setSSLContext(sslContext).setSSLHostnameVerifier((s, sslSession) -> true).build(); return client; } -- cgit 1.2.3-korg