From: Nick Burch Date: Fri, 15 Feb 2008 11:45:13 +0000 (+0000) Subject: Fix for bug #44403 - Have mid use the third argument properly, and test X-Git-Tag: REL_3_0_3_BETA1~134 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=4dfc4002eabbfcbfaa09cbbb06ddcab9e8660322;p=poi.git Fix for bug #44403 - Have mid use the third argument properly, and test git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@628027 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/documentation/content/xdocs/changes.xml b/src/documentation/content/xdocs/changes.xml index 26de01f977..d8bbb40a19 100644 --- a/src/documentation/content/xdocs/changes.xml +++ b/src/documentation/content/xdocs/changes.xml @@ -36,6 +36,7 @@ + 44403 - Fix for Mid function handling its arguments wrong 44364 - Support for Match, NA and SumProduct functions, as well as initial function error support 44375 - Cope with a broken dictionary in Document Summary Information stream. RuntimeExceptions that occured when trying to read bogus data are now caught. Dictionary entries up to but not including the bogus one are preserved, the rest is ignored. 38641 - Handle timezones better with cell.setCellValue(Calendar), so now 20:00-03:00, 20:00+00:00 and 20:00+03:00 will all be recorded as 20:00, and not 17:00 / 20:00 / 23:00 (pass a Date not a Calendar for old behaviour) diff --git a/src/documentation/content/xdocs/status.xml b/src/documentation/content/xdocs/status.xml index 2407b58fef..73e2f6852f 100644 --- a/src/documentation/content/xdocs/status.xml +++ b/src/documentation/content/xdocs/status.xml @@ -33,6 +33,7 @@ + 44403 - Fix for Mid function handling its arguments wrong 44364 - Support for Match, NA and SumProduct functions, as well as initial function error support 44375 - Cope with a broken dictionary in Document Summary Information stream. RuntimeExceptions that occured when trying to read bogus data are now caught. Dictionary entries up to but not including the bogus one are preserved, the rest is ignored. 38641 - Handle timezones better with cell.setCellValue(Calendar), so now 20:00-03:00, 20:00+00:00 and 20:00+03:00 will all be recorded as 20:00, and not 17:00 / 20:00 / 23:00 (pass a Date not a Calendar for old behaviour) diff --git a/src/scratchpad/src/org/apache/poi/hssf/record/formula/functions/Mid.java b/src/scratchpad/src/org/apache/poi/hssf/record/formula/functions/Mid.java index d6c4399ae3..1917355430 100644 --- a/src/scratchpad/src/org/apache/poi/hssf/record/formula/functions/Mid.java +++ b/src/scratchpad/src/org/apache/poi/hssf/record/formula/functions/Mid.java @@ -90,7 +90,7 @@ public class Mid extends TextFunction { } else if (startNum + numChars > str.length()) { retval = new StringEval(str.substring(startNum - 1)); } else { - retval = new StringEval(str.substring(startNum - 1, numChars)); + retval = new StringEval(str.substring(startNum - 1, (numChars + startNum - 1))); } } return retval; diff --git a/src/testcases/org/apache/poi/hssf/data/FormulaEvalTestData.xls b/src/testcases/org/apache/poi/hssf/data/FormulaEvalTestData.xls index 001432f0aa..97766d6aaa 100644 Binary files a/src/testcases/org/apache/poi/hssf/data/FormulaEvalTestData.xls and b/src/testcases/org/apache/poi/hssf/data/FormulaEvalTestData.xls differ