Reduce the number of problems in aai-common by removing unused imports
[aai/aai-common.git] / aai-core / src / main / java / org / onap / aai / util / HttpsAuthClient.java
index 0cc3aef..f8f0b65 100644 (file)
@@ -26,6 +26,7 @@ import com.sun.jersey.api.client.config.ClientConfig;
 import com.sun.jersey.api.client.config.DefaultClientConfig;
 import com.sun.jersey.api.json.JSONConfiguration;
 import com.sun.jersey.client.urlconnection.HTTPSProperties;
+
 import java.io.FileInputStream;
 import java.io.IOException;
 import java.security.KeyManagementException;
@@ -34,11 +35,13 @@ import java.security.KeyStoreException;
 import java.security.NoSuchAlgorithmException;
 import java.security.UnrecoverableKeyException;
 import java.security.cert.CertificateException;
+
 import javax.net.ssl.HostnameVerifier;
 import javax.net.ssl.HttpsURLConnection;
 import javax.net.ssl.KeyManagerFactory;
 import javax.net.ssl.SSLContext;
 import javax.net.ssl.SSLSession;
+
 import org.onap.aai.aailog.filter.RestControllerClientLoggingInterceptor;
 import org.onap.aai.exceptions.AAIException;
 import org.slf4j.Logger;
@@ -71,6 +74,7 @@ public class HttpsAuthClient {
             logger.debug("HttpsAuthClient error : {}", e.getMessage());
         }
     }
+
     /**
      * Gets the client.
      *
@@ -81,7 +85,9 @@ public class HttpsAuthClient {
      * @return the client
      * @throws KeyManagementException the key management exception
      */
-    public static Client getClient(String truststorePath, String truststorePassword, String keystorePath, String keystorePassword) throws KeyManagementException, UnrecoverableKeyException, CertificateException, NoSuchAlgorithmException, KeyStoreException, IOException {
+    public static Client getClient(String truststorePath, String truststorePassword, String keystorePath,
+            String keystorePassword) throws KeyManagementException, UnrecoverableKeyException, CertificateException,
+            NoSuchAlgorithmException, KeyStoreException, IOException {
 
         ClientConfig config = new DefaultClientConfig();
         config.getFeatures().put(JSONConfiguration.FEATURE_POJO_MAPPING, Boolean.TRUE);
@@ -112,12 +118,12 @@ public class HttpsAuthClient {
 
             ctx.init(kmf.getKeyManagers(), null, null);
             config.getProperties().put(HTTPSProperties.PROPERTY_HTTPS_PROPERTIES,
-                new HTTPSProperties(new HostnameVerifier() {
-                    @Override
-                    public boolean verify(String s, SSLSession sslSession) {
-                        return true;
-                    }
-                }, ctx));
+                    new HTTPSProperties(new HostnameVerifier() {
+                        @Override
+                        public boolean verify(String s, SSLSession sslSession) {
+                            return true;
+                        }
+                    }, ctx));
         } catch (Exception e) {
             System.out.println("Error setting up config: exiting " + e.getMessage());
             throw e;
@@ -130,22 +136,22 @@ public class HttpsAuthClient {
 
         return client;
     }
+
     /**
      * Gets the client.
      *
      * @return the client
      * @throws KeyManagementException the key management exception
      */
-    public static Client getClient() throws KeyManagementException, AAIException, UnrecoverableKeyException, CertificateException, NoSuchAlgorithmException, KeyStoreException, IOException {
+    public static Client getClient() throws KeyManagementException, AAIException, UnrecoverableKeyException,
+            CertificateException, NoSuchAlgorithmException, KeyStoreException, IOException {
         String truststorePath = null;
         String truststorePassword = null;
         String keystorePath = null;
         String keystorePassword = null;
-        truststorePath =
-            AAIConstants.AAI_HOME_ETC_AUTH + AAIConfig.get(AAIConstants.AAI_TRUSTSTORE_FILENAME);
+        truststorePath = AAIConstants.AAI_HOME_ETC_AUTH + AAIConfig.get(AAIConstants.AAI_TRUSTSTORE_FILENAME);
         truststorePassword = AAIConfig.get(AAIConstants.AAI_TRUSTSTORE_PASSWD);
-        keystorePath =
-            AAIConstants.AAI_HOME_ETC_AUTH + AAIConfig.get(AAIConstants.AAI_KEYSTORE_FILENAME);
+        keystorePath = AAIConstants.AAI_HOME_ETC_AUTH + AAIConfig.get(AAIConstants.AAI_KEYSTORE_FILENAME);
         keystorePassword = AAIConfig.get(AAIConstants.AAI_KEYSTORE_PASSWD);
         return getClient(truststorePath, truststorePassword, keystorePath, keystorePassword);
     }