DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUGĀ· RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT <http://issues.apache.org/bugzilla/show_bug.cgi?id=44413>. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED ANDĀ· INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=44413 Summary: INDEX() formula cannot contain its own location in the data array range Product: POI Version: 3.0-dev Platform: Other OS/Version: Windows XP Status: NEW Severity: normal Priority: P3 Component: HSSF AssignedTo: dev@poi.apache.org ReportedBy: [EMAIL PROTECTED] Hello All, Description ----------- If an INDEX() formula contains its own location in the data array range, parsing this spreadsheet with POI causes a recursive exception with an eventual java.lang.StackOver. Steps to Reproduce ------------------ 1/ Create a simple spreadsheet as follows A B ------------- 1 | | 1 | 2 | | 2 | 3 | | 3 | 4 | ** | | ** contains formula =INDEX(A1:B4,2,2) 2/ Notice in Excel (2003), cell A4 evaluates to 2. 3/ Parse the Excel file using POI to evaulate cell formulas (i.e. using HSSFFormulaEvaluator.CellValue cellValue = evaluator.evaluate(cell); for example) 4/ Evaluating cell A4 causes an exception. Actual Results -------------- As stated in 4/ above. Exception is: Exception in thread "main" java.lang.StackOverflowError at java.lang.Character.digit(Character.java:4531) at java.lang.Character.digit(Character.java:4490) at java.lang.Integer.parseInt(Integer.java:445) at java.lang.Integer.parseInt(Integer.java:497) at org.apache.poi.hssf.util.CellReference.<init>(CellReference.java:53) at org.apache.poi.hssf.util.AreaReference.<init>(AreaReference.java:43) at org.apache.poi.hssf.record.formula.AreaPtg.<init>(AreaPtg.java:55) at org.apache.poi.hssf.model.FormulaParser.Ident(FormulaParser.java:290) at org.apache.poi.hssf.model.FormulaParser.Factor(FormulaParser.java:522) at org.apache.poi.hssf.model.FormulaParser.Term(FormulaParser.java:660) at org.apache.poi.hssf.model.FormulaParser.Expression(FormulaParser.java:708) at org.apache.poi.hssf.model.FormulaParser.Arguments(FormulaParser.java:486) at org.apache.poi.hssf.model.FormulaParser.function(FormulaParser.java:358) at org.apache.poi.hssf.model.FormulaParser.Ident(FormulaParser.java:280) at org.apache.poi.hssf.model.FormulaParser.Factor(FormulaParser.java:522) at org.apache.poi.hssf.model.FormulaParser.Term(FormulaParser.java:660) at org.apache.poi.hssf.model.FormulaParser.Expression(FormulaParser.java:708) at org.apache.poi.hssf.model.FormulaParser.parse(FormulaParser.java:812) at org.apache.poi.hssf.usermodel.HSSFFormulaEvaluator.internalEvaluate(HSSFFormulaEvaluator.java:361) at org.apache.poi.hssf.usermodel.HSSFFormulaEvaluator.getEvalForCell(HSSFFormulaEvaluator.java:557) at org.apache.poi.hssf.usermodel.HSSFFormulaEvaluator.internalEvaluate(HSSFFormulaEvaluator.java:361) at org.apache.poi.hssf.usermodel.HSSFFormulaEvaluator.getEvalForCell(HSSFFormulaEvaluator.java:557) <REPEATED 100's OF TIMES> Expected Results ---------------- Same as Excel as stated in 2/ above. Build Date & Platform --------------------- 2008-02-13 on Windows XP Additional Information ---------------------- I can't think of the top of my head what other Excel functions are a) implemented in POI, b) use data ranges, and c) are *legal* in Excel (for instance, you can't use =SUM in a cell which is part of its own range) so as far as I know, this only affects the INDEX() function. Cheers and thanks again! Dave -- Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug, or are watching the assignee. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]