| Summary: | CanonicalConnectionEditPolicy#isOrphaned throws NullPointerException if model is corrupt | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Modeling] GMF-Runtime | Reporter: | Linda Damus <ldamus> | ||||
| Component: | General | Assignee: | Linda Damus <ldamus> | ||||
| Status: | RESOLVED FIXED | QA Contact: | |||||
| Severity: | normal | ||||||
| Priority: | P3 | CC: | aboyko, ahunter.eclipse, lgrahek | ||||
| Version: | 1.4.0 | ||||||
| Target Milestone: | 1.4.1 | ||||||
| Hardware: | PC | ||||||
| OS: | Windows XP | ||||||
| Whiteboard: | |||||||
| Attachments: |
|
||||||
Created attachment 175311 [details]
Proposed fix.
Alex, Lidija, can one of you review? Looks good to me. Committed to GMF Runtime HEAD (1.5.0) and GMF Runtime R1_4_maintenance. |
Please consider making the CanonicalConnectionEditPolicy#isOrphaned method tolerate corrupt models where the source or target of a connection cannot be resolved. This would allow the cannonical edit policy to create a new connection view to replace the one that is corrupt, since the semantic model is still intact. Proposed fix: protected boolean isOrphaned(Collection<EObject> semanticChildren, View view) { EObject element = view.getElement(); if (semanticChildren.contains(element)) { if (view instanceof Edge) { Edge edge = (Edge) view; if ((edge.getSource() == null || (edge.getSource().getElement() != getSourceElement(element))) || (edge.getTarget() == null || (edge.getTarget().getElement() != getTargetElement(element)))) return true; } } else { return true; } return false; } }