summaryrefslogtreecommitdiffstats
path: root/client
diff options
context:
space:
mode:
authorArtur Signell <artur@vaadin.com>2012-11-27 16:49:23 +0200
committerArtur Signell <artur@vaadin.com>2012-11-27 16:49:23 +0200
commit38053e8f2bd993389b3c3fce5861b6db37e66e01 (patch)
treec94c71a2940d96355b4d1c1198de067283670a26 /client
parent190500e1bb72dbaa0a8cf2de9599a99d5cc63181 (diff)
downloadvaadin-framework-38053e8f2bd993389b3c3fce5861b6db37e66e01.tar.gz
vaadin-framework-38053e8f2bd993389b3c3fce5861b6db37e66e01.zip
Fixed ClassCastException and returning of wrong connector (#10399)
Change-Id: I275f52e6084243e232478fe4d71adf8f26263fed
Diffstat (limited to 'client')
-rw-r--r--client/src/com/vaadin/client/ConnectorMap.java20
1 files changed, 18 insertions, 2 deletions
diff --git a/client/src/com/vaadin/client/ConnectorMap.java b/client/src/com/vaadin/client/ConnectorMap.java
index 0c6698bfd5..b3da12e6a3 100644
--- a/client/src/com/vaadin/client/ConnectorMap.java
+++ b/client/src/com/vaadin/client/ConnectorMap.java
@@ -50,7 +50,7 @@ public class ConnectorMap {
}
/**
- * Returns a {@link ComponentConnector} element by its root element
+ * Returns a {@link ComponentConnector} element by its root element.
*
* @param element
* Root element of the {@link ComponentConnector}
@@ -58,7 +58,23 @@ public class ConnectorMap {
* registered
*/
public ComponentConnector getConnector(Element element) {
- return (ComponentConnector) getConnector(getConnectorId(element));
+ ServerConnector connector = getConnector(getConnectorId(element));
+ if (!(connector instanceof ComponentConnector)) {
+ // This can happen at least if element is not part of this
+ // application but is part of another application and the connector
+ // id happens to map to e.g. an extension in this application
+ return null;
+ }
+
+ // Ensure this connector is really connected to the element. We cannot
+ // be sure of this otherwise as the id comes from the DOM and could be
+ // part of another application.
+ ComponentConnector cc = (ComponentConnector) connector;
+ if (cc.getWidget() == null || cc.getWidget().getElement() != element) {
+ return null;
+ }
+
+ return cc;
}
/**