summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorArtur Signell <artur.signell@itmill.com>2011-08-19 06:18:26 +0000
committerArtur Signell <artur.signell@itmill.com>2011-08-19 06:18:26 +0000
commitc0064c59cd23678bb58a112ba23c3c9d62b1bed3 (patch)
treeca9b4e6ab7a621906dcf183ec5134b0a8545e598 /src
parentc49adbc8cf61f1126986b26f54e05cb97509fd3a (diff)
downloadvaadin-framework-c0064c59cd23678bb58a112ba23c3c9d62b1bed3.tar.gz
vaadin-framework-c0064c59cd23678bb58a112ba23c3c9d62b1bed3.zip
Added messages to thrown exceptions to make debugging easier
svn changeset:20489/svn branch:6.7
Diffstat (limited to 'src')
-rw-r--r--src/com/vaadin/event/ListenerMethod.java46
1 files changed, 34 insertions, 12 deletions
diff --git a/src/com/vaadin/event/ListenerMethod.java b/src/com/vaadin/event/ListenerMethod.java
index 161aff0fb6..2c5e89921f 100644
--- a/src/com/vaadin/event/ListenerMethod.java
+++ b/src/com/vaadin/event/ListenerMethod.java
@@ -172,19 +172,26 @@ public class ListenerMethod implements EventListener, Serializable {
// Checks that the object is of correct type
if (!method.getDeclaringClass().isAssignableFrom(target.getClass())) {
- throw new java.lang.IllegalArgumentException();
+ throw new java.lang.IllegalArgumentException("The method "
+ + method.getName()
+ + " cannot be used for the given target: "
+ + target.getClass().getName());
}
// Checks that the event argument is null
if (eventArgumentIndex >= 0 && arguments[eventArgumentIndex] != null) {
- throw new java.lang.IllegalArgumentException();
+ throw new java.lang.IllegalArgumentException("argument["
+ + eventArgumentIndex + "] must be null");
}
// Checks the event type is supported by the method
if (eventArgumentIndex >= 0
&& !method.getParameterTypes()[eventArgumentIndex]
.isAssignableFrom(eventType)) {
- throw new java.lang.IllegalArgumentException();
+ throw new java.lang.IllegalArgumentException("The method "
+ + method.getName()
+ + " does not accept the given eventType: "
+ + eventType.getName());
}
this.eventType = eventType;
@@ -238,19 +245,24 @@ public class ListenerMethod implements EventListener, Serializable {
}
}
if (method == null) {
- throw new IllegalArgumentException();
+ throw new IllegalArgumentException("Method " + methodName
+ + " not found in class " + target.getClass().getName());
}
// Checks that the event argument is null
if (eventArgumentIndex >= 0 && arguments[eventArgumentIndex] != null) {
- throw new java.lang.IllegalArgumentException();
+ throw new java.lang.IllegalArgumentException("argument["
+ + eventArgumentIndex + "] must be null");
}
// Checks the event type is supported by the method
if (eventArgumentIndex >= 0
&& !method.getParameterTypes()[eventArgumentIndex]
.isAssignableFrom(eventType)) {
- throw new java.lang.IllegalArgumentException();
+ throw new java.lang.IllegalArgumentException("The method "
+ + method.getName()
+ + " does not accept the given eventType: "
+ + eventType.getName());
}
this.eventType = eventType;
@@ -291,7 +303,10 @@ public class ListenerMethod implements EventListener, Serializable {
// Check that the object is of correct type
if (!method.getDeclaringClass().isAssignableFrom(target.getClass())) {
- throw new java.lang.IllegalArgumentException();
+ throw new java.lang.IllegalArgumentException("The method "
+ + method.getName()
+ + " cannot be used for the given target: "
+ + target.getClass().getName());
}
this.eventType = eventType;
@@ -342,7 +357,8 @@ public class ListenerMethod implements EventListener, Serializable {
}
}
if (method == null) {
- throw new IllegalArgumentException();
+ throw new IllegalArgumentException("Method " + methodName
+ + " not found in class " + target.getClass().getName());
}
this.eventType = eventType;
@@ -380,7 +396,10 @@ public class ListenerMethod implements EventListener, Serializable {
// Checks that the object is of correct type
if (!method.getDeclaringClass().isAssignableFrom(target.getClass())) {
- throw new java.lang.IllegalArgumentException();
+ throw new java.lang.IllegalArgumentException("The method "
+ + method.getName()
+ + " cannot be used for the given target: "
+ + target.getClass().getName());
}
this.eventType = eventType;
@@ -396,7 +415,8 @@ public class ListenerMethod implements EventListener, Serializable {
arguments = new Object[] { null };
eventArgumentIndex = 0;
} else {
- throw new IllegalArgumentException();
+ throw new IllegalArgumentException(
+ "Method requires unknown parameters");
}
}
@@ -438,7 +458,8 @@ public class ListenerMethod implements EventListener, Serializable {
}
}
if (method == null) {
- throw new IllegalArgumentException();
+ throw new IllegalArgumentException("Method " + methodName
+ + " not found in class " + target.getClass().getName());
}
this.eventType = eventType;
@@ -454,7 +475,8 @@ public class ListenerMethod implements EventListener, Serializable {
arguments = new Object[] { null };
eventArgumentIndex = 0;
} else {
- throw new IllegalArgumentException();
+ throw new IllegalArgumentException(
+ "Method requires unknown parameters");
}
}