Skip to content

Commit 5c0a4fe

Browse files
#242 fix: The potential bug was fixed.
It was found during the self-review.
1 parent 77d9362 commit 5c0a4fe

File tree

2 files changed

+272
-216
lines changed

2 files changed

+272
-216
lines changed

src/main/java/io/appium/java_client/events/ListenerInvocationHandler.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
import java.lang.reflect.Method;
2424
import java.util.List;
2525

26-
public class ListenerInvocationHandler implements InvocationHandler {
26+
class ListenerInvocationHandler implements InvocationHandler {
2727

2828
private final List<Listener> listeners;
2929

@@ -41,8 +41,14 @@ private Method findElementInWebDriverEventListener(Method m) {
4141

4242
@Override public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
4343
for (Listener l: listeners) {
44+
boolean isInvoked = false;
4445
if (method.getDeclaringClass().isAssignableFrom(l.getClass())) {
4546
method.invoke(l, args);
47+
isInvoked = true;
48+
}
49+
50+
if (isInvoked) {
51+
continue;
4652
}
4753

4854
Method webDriverEventListenerMethod = findElementInWebDriverEventListener(method);

0 commit comments

Comments
 (0)