From 3e4ad5272b70fa6469e9c3a1b89af3e194d97261 Mon Sep 17 00:00:00 2001 From: 0xboobface <0xboobface@gmail.com> Date: Thu, 4 Apr 2019 18:58:45 +0200 Subject: [PATCH] Replace deprecated calls --- common/src/main/java/ctbrec/event/EventHandler.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) 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) {