| Summary: | Command handlers should be more robust to avoid exceptions during part de-activation. | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | [Modeling] Papyrus | Reporter: | Alain Le Guennec <alain.leguennec> | ||||||
| Component: | Core | Assignee: | Project Inbox <mdt-papyrus-inbox> | ||||||
| Status: | RESOLVED FIXED | QA Contact: | |||||||
| Severity: | normal | ||||||||
| Priority: | P3 | CC: | eclipse-bugzilla, vincent.lorenzo, yann.tanguy | ||||||
| Version: | 0.8.1 | ||||||||
| Target Milestone: | --- | ||||||||
| Hardware: | PC | ||||||||
| OS: | Windows XP | ||||||||
| Whiteboard: | |||||||||
| Attachments: |
|
||||||||
|
Description
Alain Le Guennec
Created attachment 202669 [details]
Proposed patch to (partially) fix the issue.
(1) I, Alain LE GUENNEC, wrote 100% of the code I've provided.
(2) This code contains no cryptography
(3) I have the right to contribute the code to Eclipse.
(4) I contribute the content under the EPL.
Note that this patch only makes the code more robust against null pointer exceptions. I did not refactor the code to use setEnabled() to prepare the new status of the command, which would probably be more elegant...
Patch applied in 0.8.1 (r5368) and trunk (r5369). There is still one case for which a NullPointerException is raised: If you have a model explorer customized with a Facet that use folders for FacetReferences, and you change the selection to such a folder, you'll get a NullPointerException. This is due to the function org.eclipse.papyrus.modelexplorer.handler.AbstractCommandHandler.getSelectedElements() not being robust enough: When it does adaptation to EObject, it does not check that the adaptation did not return null (which can happen for LinkItem from EMF facet). The new proposed patch solves that issue. Created attachment 203838 [details]
New patch to solve the NullPointerException with LinkItem
(1) I, Alain LE GUENNEC, wrote 100% of the code I've provided.
(2) This code contains no cryptography
(3) I have the right to contribute the code to Eclipse.
(4) I contribute the content under the EPL.
> Created attachment 203838 [details]
> New patch to solve the NullPointerException with LinkItem
I think this patch has not been applied, but the handler has been fixed anyway.
I close this task
|