diff --git a/common/src/main/java/ctbrec/event/EventHandler.java b/common/src/main/java/ctbrec/event/EventHandler.java index 4afd09a2..b925d641 100644 --- a/common/src/main/java/ctbrec/event/EventHandler.java +++ b/common/src/main/java/ctbrec/event/EventHandler.java @@ -1,5 +1,6 @@ package ctbrec.event; +import java.lang.reflect.InvocationTargetException; import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -78,10 +79,10 @@ public class EventHandler { LOG.warn("Ignoring unknown action {}", cls); continue; } - EventPredicate predicate = cls.newInstance(); + EventPredicate predicate = cls.getDeclaredConstructor().newInstance(); predicate.configure(pc); predicates.add(predicate); - } catch (InstantiationException | IllegalAccessException | ClassNotFoundException e) { + } catch (InstantiationException | IllegalAccessException | ClassNotFoundException | IllegalArgumentException | InvocationTargetException | NoSuchMethodException | SecurityException e) { LOG.warn("Error while creating action {} {}", pc.getType(), pc.getConfiguration(), e); } } @@ -98,7 +99,7 @@ public class EventHandler { LOG.warn("Ignoring unknown action {}", cls); continue; } - Action action = cls.newInstance(); + Action action = cls.getDeclaredConstructor().newInstance(); action.configure(ac); actions.add(action); } catch (Exception e) {