Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 361060 - Aggregations with nil=’true’ throw exceptions.
Summary: Aggregations with nil=’true’ throw exceptions.
Status: RESOLVED FIXED
Alias: None
Product: WTP Source Editing
Classification: WebTools
Component: wst.xpath (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: 3.4 M6   Edit
Assignee: Jesper Moller CLA
QA Contact: Jesper Moller CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-10-15 10:36 EDT by Lukasz Wycisk CLA
Modified: 2012-04-25 20:33 EDT (History)
0 users

See Also:


Attachments
patch (6.96 KB, text/plain)
2011-10-15 10:36 EDT, Lukasz Wycisk CLA
no flags Details
testcase (7.66 KB, text/plain)
2011-10-15 10:37 EDT, Lukasz Wycisk CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Lukasz Wycisk CLA 2011-10-15 10:36:51 EDT
Created attachment 205261 [details]
patch

6. Aggregations with nil=’true’. By now they throw exceptions.

TypePromoter needed changes to take empty sequences as possible arguments.

Since count was not changed and avg=sum div count - fix takes empty nodes to average:

http://www.w3.org/TR/xquery-operators/#func-avg

Please also note that $zero (second argument) in function needed to be used in empty nodes:

http://www.w3.org/TR/xquery-operators/#func-sum

Tests:

TestBugs:testNumberAggregationWithNill()
Comment 1 Lukasz Wycisk CLA 2011-10-15 10:37:12 EDT
Created attachment 205262 [details]
testcase
Comment 2 Jesper Moller CLA 2011-10-30 20:04:54 EDT
Patch looks good ... Reviewing and testing against HEAD and maintenance branches!
Comment 3 Jesper Moller CLA 2012-04-25 20:25:05 EDT
Committed -- Thanks, Lukasz