X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Forg%2Fonap%2Faai%2Fdatarouter%2Futil%2FSearchServiceAgent.java;h=4baa81a2597d611e474a96c07e64d81f304ff7fb;hb=10c04810902a100fbeba93dda5b13329ada39117;hp=42861b423f234aa7387e90ca7d8bc7ff9f546cab;hpb=5cd7658bd888db17fd0e61a9ce54b0d750333560;p=aai%2Fdata-router.git diff --git a/src/main/java/org/onap/aai/datarouter/util/SearchServiceAgent.java b/src/main/java/org/onap/aai/datarouter/util/SearchServiceAgent.java index 42861b4..4baa81a 100644 --- a/src/main/java/org/onap/aai/datarouter/util/SearchServiceAgent.java +++ b/src/main/java/org/onap/aai/datarouter/util/SearchServiceAgent.java @@ -96,14 +96,14 @@ public class SearchServiceAgent { String documentEndpoint, Logger logger) { + String deobfuscatedCertPassword = keystorePwd.startsWith("OBF:")?Password.deobfuscate(keystorePwd):keystorePwd; // Create REST client for search service searchClient = new RestClient() .authenticationMode(RestAuthenticationMode.SSL_CERT) .validateServerHostname(false) - .validateServerCertChain(true) + .validateServerCertChain(false) .clientCertFile(DataRouterConstants.DR_HOME_AUTH + certName) - .clientCertPassword(Password.deobfuscate(keystorePwd)) - .trustStore(DataRouterConstants.DR_HOME_AUTH + keystore); + .clientCertPassword(deobfuscatedCertPassword); this.searchUrl = searchUrl; this.documentEndpoint = documentEndpoint; @@ -320,8 +320,7 @@ public class SearchServiceAgent { * Removes a document from the Search Service. * * @param index - The index to create the document in. - * @param id - The identifier for the document. - * @param payload - The document contents. + * @param documentId - The identifier for the document. * @param headers - HTTP headers. */ public void deleteDocument(String index, String documentId, Map> headers) { @@ -340,12 +339,13 @@ public class SearchServiceAgent { */ protected String loadFileData(String filename) throws Exception { StringBuilder data = new StringBuilder(); - try { - BufferedReader in = new BufferedReader(new InputStreamReader( - EntityEventPolicy.class.getClassLoader().getResourceAsStream("/" + filename), - StandardCharsets.UTF_8)); - String line; + try (InputStreamReader inputStreamReader = new InputStreamReader(EntityEventPolicy.class.getClassLoader() + .getResourceAsStream("/" + filename), StandardCharsets.UTF_8); BufferedReader in = new BufferedReader( + inputStreamReader) + ) { + + String line; while ((line = in.readLine()) != null) { data.append(line); }