Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 355954 - Possible ClassCastExceptions in ManageProvidedInterfacesHandler for BDD and IBD.
Summary: Possible ClassCastExceptions in ManageProvidedInterfacesHandler for BDD and IBD.
Status: RESOLVED FIXED
Alias: None
Product: Papyrus
Classification: Modeling
Component: Core (show other bugs)
Version: 0.8.1   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-08-26 10:02 EDT by Alain Le Guennec CLA
Modified: 2011-08-29 03:30 EDT (History)
2 users (show)

See Also:


Attachments
Proposed patch to fix the issue. (2.52 KB, application/octet-stream)
2011-08-26 10:02 EDT, Alain Le Guennec CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Alain Le Guennec CLA 2011-08-26 10:02:23 EDT
Created attachment 202232 [details]
Proposed patch to fix the issue.

The code for isEnabled() for these two occurrences of ManageProvidedInterfacesHandler is incorrect and can lead to ClassCastExceptions.
Indeed, the code first checks if the selection is instanceOf Port, but even if it is not, it then goes on casting to Port anyway a few line after, instead of returning false right away.
See attached patch for proposed fix.
Comment 1 Alain Le Guennec CLA 2011-08-26 10:03:08 EDT
(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.
Comment 2 Yann Tanguy CLA 2011-08-29 03:30:13 EDT
Applied in r5316 - r5317 - r5318 (trunk & 0.8.1)