From 06e1200649398b37d1eed49a7184a54c6ff5269e Mon Sep 17 00:00:00 2001 From: Patrick Brady Date: Fri, 11 Aug 2017 11:41:51 -0700 Subject: Fixing dmaap authentication exception Dmaap http client was incorrectly throwing an exception if no authetication was present. This should not be since dmaap does not require authentication. Change-Id: If90ce1e52bf226bacc5a6c57bfe8aaa98e583bc5 Signed-off-by: Patrick Brady Issue-Id: APPC-135 --- .../adapter/messaging/dmaap/http/CommonHttpClient.java | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'appc-adapters/appc-dmaap-adapter') diff --git a/appc-adapters/appc-dmaap-adapter/appc-dmaap-adapter-bundle/src/main/java/org/openecomp/appc/adapter/messaging/dmaap/http/CommonHttpClient.java b/appc-adapters/appc-dmaap-adapter/appc-dmaap-adapter-bundle/src/main/java/org/openecomp/appc/adapter/messaging/dmaap/http/CommonHttpClient.java index ed2f13ff0..cd42e9dc6 100644 --- a/appc-adapters/appc-dmaap-adapter/appc-dmaap-adapter-bundle/src/main/java/org/openecomp/appc/adapter/messaging/dmaap/http/CommonHttpClient.java +++ b/appc-adapters/appc-dmaap-adapter/appc-dmaap-adapter-bundle/src/main/java/org/openecomp/appc/adapter/messaging/dmaap/http/CommonHttpClient.java @@ -50,23 +50,19 @@ public class CommonHttpClient { } public HttpGet getReq(URI uri, int timeoutMs) throws Exception { - if (AUTH_STR == null) { - throw new Exception("All DMaaP requests require authentication and none was provided."); - } - HttpGet out = (uri == null) ? new HttpGet() : new HttpGet(uri); - out.setHeader("Authorization", String.format("Basic %s", AUTH_STR)); + if (AUTH_STR != null) { + out.setHeader("Authorization", String.format("Basic %s", AUTH_STR)); + } out.setConfig(getConfig(timeoutMs)); return out; } public HttpPost postReq(String url) throws Exception { - if (AUTH_STR == null) { - throw new Exception("All DMaaP requests require authentication and none was provided."); - } - HttpPost out = (url == null) ? new HttpPost() : new HttpPost(url); - out.setHeader("Authorization", String.format("Basic %s", AUTH_STR)); + if (AUTH_STR != null) { + out.setHeader("Authorization", String.format("Basic %s", AUTH_STR)); + } out.setConfig(getConfig(0)); return out; } -- cgit 1.2.3-korg