diff options
author | waqas.ikram <waqas.ikram@ericsson.com> | 2018-06-11 12:04:33 +0100 |
---|---|---|
committer | waqas.ikram <waqas.ikram@ericsson.com> | 2018-06-11 13:10:42 +0100 |
commit | 275a9d6e8c8caa883a119339926fba475969b8d5 (patch) | |
tree | 644b7fc816f41862e4912eea96862ece7b5c134f /plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor | |
parent | d0746b062ca6b85eae756db6eb6c4dead037a35a (diff) |
Fixing sonar bugs
Change-Id: I05a81755ce132810c9535babb7bae5b9b9e0bd60
Issue-ID: POLICY-859
Signed-off-by: waqas.ikram <waqas.ikram@ericsson.com>
Diffstat (limited to 'plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor')
-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.java | 28 |
1 files changed, 11 insertions, 17 deletions
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 735053279..a2069a794 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 @@ -38,7 +38,6 @@ import javax.ws.rs.core.Response; import org.onap.policy.apex.core.infrastructure.threading.ApplicationThreadFactory; import org.onap.policy.apex.core.infrastructure.threading.ThreadUtilities; -import org.onap.policy.apex.plugins.event.carrier.restrequestor.RESTRequestorCarrierTechnologyParameters.HTTP_METHOD; import org.onap.policy.apex.service.engine.event.ApexEventConsumer; import org.onap.policy.apex.service.engine.event.ApexEventException; import org.onap.policy.apex.service.engine.event.ApexEventReceiver; @@ -50,8 +49,8 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** - * This class implements an Apex event consumer that issues a REST request and returns the REST response to APEX as an - * event. + * This class implements an Apex event consumer that issues a REST request and returns the REST + * response to APEX as an event. * * @author Liam Fallon (liam.fallon@ericsson.com) */ @@ -59,7 +58,8 @@ public class ApexRestRequestorConsumer implements ApexEventConsumer, Runnable { // Get a reference to the logger private static final Logger LOGGER = LoggerFactory.getLogger(ApexRestRequestorConsumer.class); - // The amount of time to wait in milliseconds between checks that the consumer thread has stopped + // The amount of time to wait in milliseconds between checks that the consumer thread has + // stopped private static final long REST_REQUESTOR_WAIT_SLEEP_TIME = 50; // The REST parameters read from the parameter service @@ -128,14 +128,6 @@ public class ApexRestRequestorConsumer implements ApexEventConsumer, Runnable { .setHttpMethod(RESTRequestorCarrierTechnologyParameters.DEFAULT_REQUESTOR_HTTP_METHOD); } - if (!(restConsumerProperties.getHttpMethod() instanceof HTTP_METHOD)) { - final String errorMessage = "specified HTTP method of \"" + restConsumerProperties.getHttpMethod() - + "\" is invalid, only HTTP methods " + HTTP_METHOD.values() - + " are valid on REST Requestor consumer (" + this.name + ")"; - LOGGER.warn(errorMessage); - throw new ApexEventException(errorMessage); - } - // Check if the HTTP URL has been set if (restConsumerProperties.getURL() == null) { final String errorMessage = "no URL has been specified on REST Requestor consumer (" + this.name + ")"; @@ -215,8 +207,8 @@ public class ApexRestRequestorConsumer implements ApexEventConsumer, Runnable { /* * (non-Javadoc) * - * @see org.onap.policy.apex.service.engine.event.ApexEventConsumer#getPeeredReference(org.onap.policy.apex.service. - * parameters.eventhandler.EventHandlerPeeredMode) + * @see org.onap.policy.apex.service.engine.event.ApexEventConsumer#getPeeredReference(org.onap. + * policy.apex.service. parameters.eventhandler.EventHandlerPeeredMode) */ @Override public PeeredReference getPeeredReference(final EventHandlerPeeredMode peeredMode) { @@ -226,8 +218,9 @@ public class ApexRestRequestorConsumer implements ApexEventConsumer, Runnable { /* * (non-Javadoc) * - * @see org.onap.policy.apex.service.engine.event.ApexEventConsumer#setPeeredReference(org.onap.policy.apex.service. - * parameters.eventhandler.EventHandlerPeeredMode, org.onap.policy.apex.service.engine.event.PeeredReference) + * @see org.onap.policy.apex.service.engine.event.ApexEventConsumer#setPeeredReference(org.onap. + * policy.apex.service. parameters.eventhandler.EventHandlerPeeredMode, + * org.onap.policy.apex.service.engine.event.PeeredReference) */ @Override public void setPeeredReference(final EventHandlerPeeredMode peeredMode, final PeeredReference peeredReference) { @@ -256,7 +249,8 @@ public class ApexRestRequestorConsumer implements ApexEventConsumer, Runnable { // Set the time stamp of the REST request restRequest.setTimestamp(System.currentTimeMillis()); - // Create a thread to process the REST request and place it on the map of ongoing requests + // Create a thread to process the REST request and place it on the map of ongoing + // requests final RestRequestRunner restRequestRunner = new RestRequestRunner(restRequest); ongoingRestRequestMap.put(restRequest, restRequestRunner); |