summaryrefslogtreecommitdiffstats
path: root/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/EventConsumerFactory.java
diff options
context:
space:
mode:
Diffstat (limited to 'services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/EventConsumerFactory.java')
-rw-r--r--services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/EventConsumerFactory.java18
1 files changed, 9 insertions, 9 deletions
diff --git a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/EventConsumerFactory.java b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/EventConsumerFactory.java
index 30a44e024..2f6922a2b 100644
--- a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/EventConsumerFactory.java
+++ b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/EventConsumerFactory.java
@@ -1,7 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
- * Modifications Copyright (C) 2019 Nordix Foundation.
+ * Modifications Copyright (C) 2019-2020 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -46,7 +46,7 @@ public class EventConsumerFactory {
* @throws ApexEventException on errors creating the Apex event consumer
*/
public ApexEventConsumer createConsumer(final String name, final EventHandlerParameters consumerParameters)
- throws ApexEventException {
+ throws ApexEventException {
// Get the carrier technology parameters
final CarrierTechnologyParameters technologyParameters = consumerParameters.getCarrierTechnologyParameters();
@@ -54,11 +54,11 @@ public class EventConsumerFactory {
final String consumerPluginClass = technologyParameters.getEventConsumerPluginClass();
Object consumerPluginObject = null;
try {
- consumerPluginObject = Class.forName(consumerPluginClass).newInstance();
- } catch (InstantiationException | IllegalAccessException | ClassNotFoundException e) {
+ consumerPluginObject = Class.forName(consumerPluginClass).getDeclaredConstructor().newInstance();
+ } catch (final Exception e) {
final String errorMessage = "could not create an Apex event consumer for \"" + name
- + "\" for the carrier technology \"" + technologyParameters.getLabel()
- + "\", specified event consumer plugin class \"" + consumerPluginClass + "\" not found";
+ + "\" for the carrier technology \"" + technologyParameters.getLabel()
+ + "\", specified event consumer plugin class \"" + consumerPluginClass + "\" not found";
LOGGER.error(errorMessage, e);
throw new ApexEventException(errorMessage, e);
}
@@ -66,9 +66,9 @@ public class EventConsumerFactory {
// Check the class is an event consumer
if (!(consumerPluginObject instanceof ApexEventConsumer)) {
final String errorMessage = "could not create an Apex event consumer \"" + name
- + "\" for the carrier technology \"" + technologyParameters.getLabel()
- + "\", specified event consumer plugin class \"" + consumerPluginClass
- + "\" is not an instance of \"" + ApexEventConsumer.class.getName() + "\"";
+ + "\" for the carrier technology \"" + technologyParameters.getLabel()
+ + "\", specified event consumer plugin class \"" + consumerPluginClass
+ + "\" is not an instance of \"" + ApexEventConsumer.class.getName() + "\"";
LOGGER.error(errorMessage);
throw new ApexEventException(errorMessage);
}