diff options
Diffstat (limited to 'appc-adapters/appc-dmaap-adapter/appc-dmaap-adapter-bundle/src/main/java')
2 files changed, 12 insertions, 8 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 a2e15797a..ed2f13ff0 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,19 +50,23 @@ public class CommonHttpClient { } public HttpGet getReq(URI uri, int timeoutMs) throws Exception { - HttpGet out = (uri == null) ? new HttpGet() : new HttpGet(uri); - if (AUTH_STR != null) { - out.setHeader("Authorization", String.format("Basic %s", AUTH_STR)); - } + 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)); out.setConfig(getConfig(timeoutMs)); return out; } public HttpPost postReq(String url) throws Exception { - HttpPost out = (url == null) ? new HttpPost() : new HttpPost(url); - if (AUTH_STR != null) { - out.setHeader("Authorization", String.format("Basic %s", AUTH_STR)); + 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)); out.setConfig(getConfig(0)); return out; } diff --git a/appc-adapters/appc-dmaap-adapter/appc-dmaap-adapter-bundle/src/main/java/org/openecomp/appc/adapter/messaging/dmaap/http/HttpDmaapProducerImpl.java b/appc-adapters/appc-dmaap-adapter/appc-dmaap-adapter-bundle/src/main/java/org/openecomp/appc/adapter/messaging/dmaap/http/HttpDmaapProducerImpl.java index 1073e152f..aeb248c9b 100644 --- a/appc-adapters/appc-dmaap-adapter/appc-dmaap-adapter-bundle/src/main/java/org/openecomp/appc/adapter/messaging/dmaap/http/HttpDmaapProducerImpl.java +++ b/appc-adapters/appc-dmaap-adapter/appc-dmaap-adapter-bundle/src/main/java/org/openecomp/appc/adapter/messaging/dmaap/http/HttpDmaapProducerImpl.java @@ -119,7 +119,7 @@ public class HttpDmaapProducerImpl extends CommonHttpClient implements Producer } /** - * Format the body for the application/cambria content type with no partitioning. + * Format the body for the application/cambria content type with no partitioning. See * * @param msg * The message body to format |