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

Bug 361060

Summary: Aggregations with nil=’true’ throw exceptions.
Product: [WebTools] WTP Source Editing Reporter: Lukasz Wycisk <lukasz>
Component: wst.xpathAssignee: Jesper Moller <jesper>
Status: RESOLVED FIXED QA Contact: Jesper Moller <jesper>
Severity: normal    
Priority: P3    
Version: unspecified   
Target Milestone: 3.4 M6   
Hardware: PC   
OS: Windows 7   
Whiteboard:
Attachments:
Description Flags
patch
none
testcase none

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