Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 355954

Summary: Possible ClassCastExceptions in ManageProvidedInterfacesHandler for BDD and IBD.
Product: [Modeling] Papyrus Reporter: Alain Le Guennec <alain.leguennec>
Component: CoreAssignee: Project Inbox <mdt-papyrus-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: eclipse-bugzilla, yann.tanguy
Version: 0.8.1   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Proposed patch to fix the issue. none

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)