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

Bug 428745

Summary: Empty border size computation expression leads to NullPointerException
Product: [Modeling] Sirius Reporter: Stéphane Thibaudeau <stephane.thibaudeau>
Component: DiagramAssignee: Project Inbox <sirius.diagram-inbox>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P1 CC: alex.lagarde, belqassim.djafer, maxime.porhel, pierre-charles.david
Version: 1.0.0M5Keywords: triaged
Target Milestone: 3.0.0M5   
Hardware: All   
OS: All   
See Also: https://git.eclipse.org/r/44505
https://git.eclipse.org/c/sirius/org.eclipse.sirius.git/commit/?id=8747a7775da6dcea7c078985ac49f288c672c041
https://git.eclipse.org/r/44816
https://git.eclipse.org/c/sirius/org.eclipse.sirius.git/commit/?id=7893b09339bfecbf7c1ea064eb501b58c62969e5
https://git.eclipse.org/r/45618
https://git.eclipse.org/c/sirius/org.eclipse.sirius.git/commit/?id=4127adbc9cd745987adfac4fc849eb0ab1eced5f
Whiteboard:
Attachments:
Description Flags
Example viewpoint specification project none

Description Stéphane Thibaudeau CLA 2014-02-21 09:26:02 EST
Created attachment 240198 [details]
Example viewpoint specification project

On a container mapping, delete default contents in "Border Size Computation Expression" :
- validation is OK
- when trying to create a diagram, a NullPointerException is thrown.

Steps to reproduce :
- import the provided viewpoint specification project
- create a diagram on the root EPackage of model 'model/My.ecore'
Comment 1 Alex Lagarde CLA 2014-02-21 09:36:57 EST
Issue reproduced with Sirius 1.0 M5

Setting a Border Size Computation Expression allows to avoid the exception
Comment 2 Stéphane Thibaudeau CLA 2014-02-21 09:51:10 EST
Then the validation should not be OK when this field is not specified.
Comment 3 Maxime Porhel CLA 2014-04-14 08:00:33 EDT
A null/empty border size computation expression should lead to a 0 (or 1 regarding the current styles behaviors) pixel margin.
Comment 4 Maxime Porhel CLA 2014-11-21 08:41:41 EST
I see two area requiring corrections:
 . VSM editor: 
     . validation rule to check that no border expression is null (could be generalized to all interpreted expression) 
     . customize the border size expr property section to replace a null value by the default MM value (0) during edition
 . Sirius core: 
     . clean the actual code (see borderStyle/BorderStyleDescription#getBordersizeExpression call) and try to remove duplicated code
     . correctly handle the empty/null expression by setting the default style value and never null.
Comment 5 Maxime Porhel CLA 2014-11-21 08:56:46 EST
I see two area requiring corrections:
 . VSM editor: 
     . validation rule to check that no border expression is null (could be generalized to all interpreted expression) 
     . customize the border size expr property section to replace a null value by the default MM value (0) during edition
 . Sirius core: 
     . clean the actual code (see borderStyle/BorderStyleDescription#getBordersizeExpression call) and try to remove duplicated code
     . correctly handle the empty/null expression by setting the default style value and never null.
Comment 6 Belqassim Djafer CLA 2014-12-03 09:27:25 EST
I propose the fix : https://git.eclipse.org/r/#/c/36900/
Comment 7 Pierre-Charles David CLA 2015-01-26 05:28:39 EST
Fixed by 5d8d34ffaeeb8408bfc1715481c9b83943da1478.
Comment 8 Eclipse Genie CLA 2015-03-24 12:52:00 EDT
New Gerrit change created: https://git.eclipse.org/r/44505
Comment 10 Eclipse Genie CLA 2015-03-30 04:18:32 EDT
New Gerrit change created: https://git.eclipse.org/r/44816
Comment 12 Belqassim Djafer CLA 2015-04-09 09:06:36 EDT
Verified on Sirius 3.0.0M6
Comment 13 Eclipse Genie CLA 2015-04-10 04:32:35 EDT
New Gerrit change created: https://git.eclipse.org/r/45618
Comment 15 Pierre-Charles David CLA 2015-06-24 11:14:47 EDT
Available in Sirius 3.0.0. See https://wiki.eclipse.org/Sirius/3.0.0.