diff options
Diffstat (limited to 'reception')
4 files changed, 15 insertions, 9 deletions
diff --git a/reception/src/main/java/org/onap/policy/distribution/reception/handling/AbstractReceptionHandler.java b/reception/src/main/java/org/onap/policy/distribution/reception/handling/AbstractReceptionHandler.java index 2ea18704..52c34cec 100644 --- a/reception/src/main/java/org/onap/policy/distribution/reception/handling/AbstractReceptionHandler.java +++ b/reception/src/main/java/org/onap/policy/distribution/reception/handling/AbstractReceptionHandler.java @@ -2,6 +2,7 @@ * ============LICENSE_START======================================================= * Copyright (C) 2018 Ericsson. All rights reserved. * Copyright (C) 2019 Nordix Foundation. + * Copyright (C) 2020 AT&T Inc. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -85,7 +86,7 @@ public abstract class AbstractReceptionHandler implements ReceptionHandler { try { policyForwarder.forward(policies); } catch (final PolicyForwardingException policyForwardingException) { - LOGGER.error("Error when forwarding policies to " + policyForwarder, policyForwardingException); + LOGGER.error("Error when forwarding policies to {}", policyForwarder, policyForwardingException); } } } diff --git a/reception/src/main/java/org/onap/policy/distribution/reception/handling/PluginHandler.java b/reception/src/main/java/org/onap/policy/distribution/reception/handling/PluginHandler.java index f837e520..5067c841 100644 --- a/reception/src/main/java/org/onap/policy/distribution/reception/handling/PluginHandler.java +++ b/reception/src/main/java/org/onap/policy/distribution/reception/handling/PluginHandler.java @@ -2,6 +2,7 @@ * ============LICENSE_START======================================================= * Copyright (C) 2018 Ericsson. All rights reserved. * Copyright (C) 2019 Nordix Foundation. + * Modifications Copyright (C) 2020 AT&T Inc. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,6 +22,7 @@ package org.onap.policy.distribution.reception.handling; +import java.lang.reflect.InvocationTargetException; import java.util.ArrayList; import java.util.Collection; import java.util.Map; @@ -92,11 +94,13 @@ public class PluginHandler { final Class<PolicyDecoder<PolicyInput, ToscaEntity>> policyDecoderClass = (Class<PolicyDecoder<PolicyInput, ToscaEntity>>) Class .forName(decoderParameters.getDecoderClassName()); - final PolicyDecoder<PolicyInput, ToscaEntity> decoder = policyDecoderClass.newInstance(); + final PolicyDecoder<PolicyInput, ToscaEntity> decoder = + policyDecoderClass.getDeclaredConstructor().newInstance(); decoder.configure(decoderParameters.getDecoderConfigurationName()); policyDecoders.add(decoder); - } catch (final ClassNotFoundException | InstantiationException | IllegalAccessException exp) { - LOGGER.error("exception occured while initializing decoders", exp); + } catch (final ClassNotFoundException | InstantiationException | IllegalAccessException + | IllegalArgumentException | InvocationTargetException | NoSuchMethodException + | SecurityException exp) { throw new PluginInitializationException(exp.getMessage(), exp.getCause()); } } @@ -116,11 +120,12 @@ public class PluginHandler { try { final Class<PolicyForwarder> policyForwarderClass = (Class<PolicyForwarder>) Class.forName(forwarderParameters.getForwarderClassName()); - final PolicyForwarder policyForwarder = policyForwarderClass.newInstance(); + final PolicyForwarder policyForwarder = policyForwarderClass.getDeclaredConstructor().newInstance(); policyForwarder.configure(forwarderParameters.getForwarderConfigurationName()); policyForwarders.add(policyForwarder); - } catch (final ClassNotFoundException | InstantiationException | IllegalAccessException exp) { - LOGGER.error("exception occured while initializing forwarders", exp); + } catch (final ClassNotFoundException | InstantiationException | IllegalAccessException + | IllegalArgumentException | InvocationTargetException | NoSuchMethodException + | SecurityException exp) { throw new PluginInitializationException(exp.getMessage(), exp.getCause()); } } diff --git a/reception/src/main/java/org/onap/policy/distribution/reception/parameters/PolicyDecoderConfigurationParametersJsonAdapter.java b/reception/src/main/java/org/onap/policy/distribution/reception/parameters/PolicyDecoderConfigurationParametersJsonAdapter.java index c30d3d3d..b1c8053b 100644 --- a/reception/src/main/java/org/onap/policy/distribution/reception/parameters/PolicyDecoderConfigurationParametersJsonAdapter.java +++ b/reception/src/main/java/org/onap/policy/distribution/reception/parameters/PolicyDecoderConfigurationParametersJsonAdapter.java @@ -2,6 +2,7 @@ * ============LICENSE_START======================================================= * Copyright (C) 2018 Ericsson. All rights reserved. * Copyright (C) 2019 Nordix Foundation. + * Modifications Copyright (C) 2020 AT&T Inc. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -75,7 +76,6 @@ public class PolicyDecoderConfigurationParametersJsonAdapter } catch (final ClassNotFoundException exp) { final String errorMessage = "parameter \"" + PARAMETER_CLASS_NAME + "\" value \"" + policyDecoderParameterClassName + "\", could not find class"; - LOGGER.warn(errorMessage, exp); throw new IllegalArgumentException(errorMessage, exp); } return policyDecoderParameterClass; diff --git a/reception/src/main/java/org/onap/policy/distribution/reception/parameters/ReceptionHandlerConfigurationParametersJsonAdapter.java b/reception/src/main/java/org/onap/policy/distribution/reception/parameters/ReceptionHandlerConfigurationParametersJsonAdapter.java index 9b3a4d2b..9a34ee61 100644 --- a/reception/src/main/java/org/onap/policy/distribution/reception/parameters/ReceptionHandlerConfigurationParametersJsonAdapter.java +++ b/reception/src/main/java/org/onap/policy/distribution/reception/parameters/ReceptionHandlerConfigurationParametersJsonAdapter.java @@ -2,6 +2,7 @@ * ============LICENSE_START======================================================= * Copyright (C) 2018 Ericsson. All rights reserved. * Copyright (C) 2019 Nordix Foundation. + * Modifications Copyright (C) 2020 AT&T Inc. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -74,7 +75,6 @@ public class ReceptionHandlerConfigurationParametersJsonAdapter } catch (final ClassNotFoundException e) { final String errorMessage = "parameter \"" + PARAMETER_CLASS_NAME + "\" value \"" + receptionHAndlerParameterClassName + "\", could not find class"; - LOGGER.warn(errorMessage, e); throw new IllegalArgumentException(errorMessage, e); } return receptionHandlerParameterClass; |