Bug 294127

Summary: Helper of tuple return type may cause runtime exception during evaluation
Product: [Modeling] QVTo Reporter: Radomil Dvorak <dvorak.radek>
Component: EngineAssignee: Radomil Dvorak <dvorak.radek>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: serg.boyko2011
Version: 2.0   
Target Milestone: 2.0.1   
Hardware: Macintosh   
OS: Mac OS X - Carbon (unsup.)   
Whiteboard:
Attachments:
Description Flags
The code that prepares 'extent' is now not used in cases when 'extent' is not used (i.e.when isMapping is false)
serg.boyko2011: iplog+
A unit test for the patch none

Description Radomil Dvorak CLA 2009-11-03 16:55:14 EST
Helper operation which returns a tuple instance having any of its part of <null> value cause
runtime exception during execution.

The issues can be reproduced using the code snippet bellow:

helper createTuple() : a : String, b : Integer {
	a := null; -- null value of a tuple part cause runtime exception
	b := 10;
}

main() {
	var t:= createTuple();
}

Stack trace:
-----------

java.lang.ClassCastException: org.eclipse.m2m.internal.qvt.oml.expressions.impl.VarParameterImpl cannot be cast to org.eclipse.m2m.internal.qvt.oml.expressions.MappingParameter
at org.eclipse.m2m.internal.qvt.oml.evaluator.QvtOperationalEvaluationVisitorImpl.createTupleResult(QvtOperationalEvaluationVisitorImpl.java:1931)
at org.eclipse.m2m.internal.qvt.oml.evaluator.QvtOperationalEvaluationVisitorImpl.visitOperationBody(QvtOperationalEvaluationVisitorImpl.java:993)
at org.eclipse.m2m.internal.qvt.oml.evaluator.QvtOperationalEvaluationVisitorImpl.visitHelper(QvtOperationalEvaluationVisitorImpl.java:464)
Comment 1 Alex Paperno CLA 2013-07-21 19:26:29 EDT
Created attachment 233656 [details]
The code that prepares 'extent' is now not used in cases when 'extent' is not used (i.e.when isMapping is false)
Comment 2 Alex Paperno CLA 2013-07-21 19:26:42 EDT
Created attachment 233657 [details]
A unit test for the patch
Comment 3 Sergey Boyko CLA 2013-07-23 15:48:09 EDT
Comment on attachment 233656 [details]
The code that prepares 'extent' is now not used in cases when 'extent' is not used (i.e.when isMapping is false)

The patch is accurate. It exactly remediates the problem mentioned with tuple creation by helper. Junit test passed.
Comment 4 Sergey Boyko CLA 2013-07-23 15:50:29 EDT
Pushed to master.

Commit ID: 5223621bf728735416905bf2eee7750c9c5e4c58