[prev in list] [next in list] [prev in thread] [next in thread]
List: poi-dev
Subject: [Bug 56146] New: coerceValueToString does not return an empty string when given a MissingArgEval par
From: bugzilla () apache ! org
Date: 2014-02-17 17:01:54
Message-ID: bug-56146-47293 () https ! issues ! apache ! org/bugzilla/
[Download RAW message or body]
https://issues.apache.org/bugzilla/show_bug.cgi?id=56146
Bug ID: 56146
Summary: coerceValueToString does not return an empty string
when given a MissingArgEval parameter
Product: POI
Version: 3.9
Hardware: PC
Status: NEW
Severity: minor
Priority: P2
Component: POI Overall
Assignee: dev@poi.apache.org
Reporter: cquezel@gmail.com
When dealing with spreadsheets (tested Excel and LibreOfice) when a function is
called with a missing parameter, they sometimes provide a default empty string
parameter.
I noticed this with the substitute function:
SUBSTITUTE( text, old_text, new_text, [nth_appearance] )
In the spreadsheet I was using, the mandatory "new_text" parameter was not
specified. Excel and LibreOffice both provided a default empty string.
I think the POI behaviour to throw an exception is correct (althought the error
message is not very usefull) but, if the goal is to be compatible with Excel,
then the behviour should probably be changed.
public static String coerceValueToString(ValueEval ve) {
if (ve instanceof StringValueEval) {
StringValueEval sve = (StringValueEval) ve;
return sve.getStringValue();
}
if (ve == BlankEval.instance) {
return "";
}
// Start of patch
if (ve == MissingArgEval.instance) {
return "";
}
// End of patch
throw new IllegalArgumentException("Unexpected eval class (" +
ve.getClass().getName() + ")");
}
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic