Bug 55195

Summary: [PATCH] MultiOperandNumericFunction.collectValue() currently uses concrete final classes but should use interfaces instead
Product: POI Reporter: malfree
Component: HSSFAssignee: POI Developers List <dev>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P2    
Version: 3.9-FINAL   
Target Milestone: ---   
Hardware: PC   
OS: Mac OS X 10.4   
Attachments: patch file

Description malfree 2013-07-04 02:19:35 UTC
Currently:
if (ve instanceof NumberEval) {
	NumberEval ne = (NumberEval) ve;
	temp.add(ne.getNumberValue());
	return;
}

Instead, it should be:
if (ve instanceof NumericValueEval) {
	NumericValueEval ne = (NumericValueEval) ve;
	temp.add(ne.getNumberValue());
	return;
}

Same is true for StringEval vs. StringValueEval.

While the current approach technically works, it provides no ability to provide custom implementations of return values from user defined functions.
Comment 1 malfree 2013-07-04 02:29:57 UTC
Add HSSFFormulaEvaluator.evaluateFormulaCellValue() to the list as well
Comment 2 Nick Burch 2013-07-04 09:22:23 UTC
Are you able to produce a patch of the changes needed?
Comment 3 malfree 2013-07-05 01:57:05 UTC
Created attachment 30534 [details]
patch file
Comment 4 Dominik Stadler 2013-08-12 20:31:06 UTC
Applied, thanks for the patch.