summaryrefslogtreecommitdiffstats
path: root/plugins/plugins-event/plugins-event-carrier
diff options
context:
space:
mode:
authorliamfallon <liam.fallon@est.tech>2019-02-05 17:37:24 +0000
committerliamfallon <liam.fallon@est.tech>2019-02-05 17:37:24 +0000
commit05df038e0b09bfd5f0c9bfc1e8aa10f9c97f39a4 (patch)
tree05779d28246969ee2b87ebbd9868be954dded78a /plugins/plugins-event/plugins-event-carrier
parentaacfb4ca7da6a76282c5703049fb7b52f65a36a8 (diff)
Fix bug with Apex rejecting HTTP 2xx responses
APEX rejects all HTTP responses except 200. This change accepts any HTTP 2xx response code as a valid response. Issue-ID: POLICY-1289 Change-Id: Ief681ba4dac1ef3ff5f257dd931569bd2274d017 Signed-off-by: liamfallon <liam.fallon@est.tech>
Diffstat (limited to 'plugins/plugins-event/plugins-event-carrier')
-rw-r--r--plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/main/java/org/onap/policy/apex/plugins/event/carrier/restclient/ApexRestClientConsumer.java2
-rw-r--r--plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src/main/java/org/onap/policy/apex/plugins/event/carrier/restrequestor/ApexRestRequestorConsumer.java2
2 files changed, 2 insertions, 2 deletions
diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/main/java/org/onap/policy/apex/plugins/event/carrier/restclient/ApexRestClientConsumer.java b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/main/java/org/onap/policy/apex/plugins/event/carrier/restclient/ApexRestClientConsumer.java
index 5591777eb..ddd000dd9 100644
--- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/main/java/org/onap/policy/apex/plugins/event/carrier/restclient/ApexRestClientConsumer.java
+++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restclient/src/main/java/org/onap/policy/apex/plugins/event/carrier/restclient/ApexRestClientConsumer.java
@@ -205,7 +205,7 @@ public class ApexRestClientConsumer implements ApexEventConsumer, Runnable {
.headers(restConsumerProperties.getHttpHeadersAsMultivaluedMap()).get();
// Check that the event request worked
- if (response.getStatus() != Response.Status.OK.getStatusCode()) {
+ if (!Response.Status.Family.familyOf(response.getStatus()).equals(Response.Status.Family.SUCCESSFUL)) {
final String errorMessage = "reception of event from URL \"" + restConsumerProperties.getUrl()
+ "\" failed with status code " + response.getStatus() + " and message \""
+ response.readEntity(String.class) + "\"";
diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src/main/java/org/onap/policy/apex/plugins/event/carrier/restrequestor/ApexRestRequestorConsumer.java b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src/main/java/org/onap/policy/apex/plugins/event/carrier/restrequestor/ApexRestRequestorConsumer.java
index 746fc85c4..57c14b946 100644
--- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src/main/java/org/onap/policy/apex/plugins/event/carrier/restrequestor/ApexRestRequestorConsumer.java
+++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src/main/java/org/onap/policy/apex/plugins/event/carrier/restrequestor/ApexRestRequestorConsumer.java
@@ -351,7 +351,7 @@ public class ApexRestRequestorConsumer implements ApexEventConsumer, Runnable {
final Response response = sendEventAsRestRequest();
// Check that the event request worked
- if (response.getStatus() != Response.Status.OK.getStatusCode()) {
+ if (!Response.Status.Family.familyOf(response.getStatus()).equals(Response.Status.Family.SUCCESSFUL)) {
final String errorMessage = "reception of response to \"" + request + "\" from URL \""
+ restConsumerProperties.getUrl() + "\" failed with status code "
+ response.getStatus() + " and message \"" + response.readEntity(String.class)