Browse Source

Fixed ClassCastException and returning of wrong connector (#10399)

Change-Id: I275f52e6084243e232478fe4d71adf8f26263fed
tags/7.0.0.beta11
Artur Signell 11 years ago
parent
commit
38053e8f2b
1 changed files with 18 additions and 2 deletions
  1. 18
    2
      client/src/com/vaadin/client/ConnectorMap.java

+ 18
- 2
client/src/com/vaadin/client/ConnectorMap.java View File

@@ -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;
}

/**

Loading…
Cancel
Save