diff options
author | Ahmed Ashour <asashour@yahoo.com> | 2017-10-03 12:56:48 +0200 |
---|---|---|
committer | Henri Sara <henri.sara@gmail.com> | 2017-10-03 13:56:48 +0300 |
commit | bf690d31eb986ef1803324ff2bd628104a7cb0fe (patch) | |
tree | 9f22d0afa779d8c1959db2986e2f538db33f39f2 | |
parent | ccad305464af83826de4a4bd25a383360fb356d0 (diff) | |
download | vaadin-framework-bf690d31eb986ef1803324ff2bd628104a7cb0fe.tar.gz vaadin-framework-bf690d31eb986ef1803324ff2bd628104a7cb0fe.zip |
Break iteration when method is found (#10128)
-rw-r--r-- | server/src/main/java/com/vaadin/event/EventRouter.java | 3 | ||||
-rw-r--r-- | server/src/main/java/com/vaadin/event/ListenerMethod.java | 8 |
2 files changed, 4 insertions, 7 deletions
diff --git a/server/src/main/java/com/vaadin/event/EventRouter.java b/server/src/main/java/com/vaadin/event/EventRouter.java index 59599a0aac..a6bb030cf8 100644 --- a/server/src/main/java/com/vaadin/event/EventRouter.java +++ b/server/src/main/java/com/vaadin/event/EventRouter.java @@ -135,6 +135,7 @@ public class EventRouter implements MethodEventSource { for (Method m : methods) { if (m.getName().equals(methodName)) { method = m; + break; } } if (method == null) { @@ -152,7 +153,6 @@ public class EventRouter implements MethodEventSource { } } } - } /** @@ -209,7 +209,6 @@ public class EventRouter implements MethodEventSource { listenerMethod.receiveEvent(event); } } - } } diff --git a/server/src/main/java/com/vaadin/event/ListenerMethod.java b/server/src/main/java/com/vaadin/event/ListenerMethod.java index 9159f7f781..8391303c89 100644 --- a/server/src/main/java/com/vaadin/event/ListenerMethod.java +++ b/server/src/main/java/com/vaadin/event/ListenerMethod.java @@ -243,10 +243,10 @@ public class ListenerMethod implements EventListener, Serializable { throws IllegalArgumentException { // Finds the correct method - Method method = null; for (Method m : target.getClass().getMethods()) { if (m.getName().equals(methodName)) { method = m; + break; } } if (method == null) { @@ -271,7 +271,6 @@ public class ListenerMethod implements EventListener, Serializable { this.eventType = eventType; this.target = target; - this.method = method; this.arguments = arguments; this.eventArgumentIndex = eventArgumentIndex; } @@ -355,6 +354,7 @@ public class ListenerMethod implements EventListener, Serializable { for (Method m : target.getClass().getMethods()) { if (m.getName().equals(methodName)) { method = m; + break; } } if (method == null) { @@ -364,7 +364,6 @@ public class ListenerMethod implements EventListener, Serializable { this.eventType = eventType; this.target = target; - this.method = method; this.arguments = arguments; eventArgumentIndex = -1; } @@ -451,10 +450,10 @@ public class ListenerMethod implements EventListener, Serializable { throws IllegalArgumentException { // Finds the correct method - Method method = null; for (Method m : target.getClass().getMethods()) { if (m.getName().equals(methodName)) { method = m; + break; } } if (method == null) { @@ -464,7 +463,6 @@ public class ListenerMethod implements EventListener, Serializable { this.eventType = eventType; this.target = target; - this.method = method; eventArgumentIndex = -1; final Class<?>[] params = method.getParameterTypes(); |