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: cque...@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-unsubscr...@poi.apache.org For additional commands, e-mail: dev-h...@poi.apache.org