diff options
author | Patrick Brady <pb071s@att.com> | 2017-08-11 11:41:51 -0700 |
---|---|---|
committer | Patrick Brady <pb071s@att.com> | 2017-08-11 12:20:42 -0700 |
commit | 06e1200649398b37d1eed49a7184a54c6ff5269e (patch) | |
tree | 0e60caa68d3c15d45f26abb67928584cc065e006 /appc-adapters/appc-dmaap-adapter/appc-dmaap-adapter-bundle/src | |
parent | fe0e98940048cad839c629821da78b3fcf33b6d2 (diff) |
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 <pb071s@att.com>
Issue-Id: APPC-135
Diffstat (limited to 'appc-adapters/appc-dmaap-adapter/appc-dmaap-adapter-bundle/src')
-rw-r--r-- | appc-adapters/appc-dmaap-adapter/appc-dmaap-adapter-bundle/src/main/java/org/openecomp/appc/adapter/messaging/dmaap/http/CommonHttpClient.java | 16 |
1 files changed, 6 insertions, 10 deletions
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; } |