You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by bu...@apache.org on 2010/04/20 15:43:20 UTC
DO NOT REPLY [Bug 49156] New: NPE when evaluateInCell is used
https://issues.apache.org/bugzilla/show_bug.cgi?id=49156
Summary: NPE when evaluateInCell is used
Product: POI
Version: 3.7-dev
Platform: PC
OS/Version: Windows XP
Status: NEW
Severity: critical
Priority: P2
Component: XSSF
AssignedTo: dev@poi.apache.org
ReportedBy: vgavr@rogers.com
During evaluation of formulas using FormulaEvaluator's evaluateInCell(cell) -
getting the following NPE. Using evaluateFormulaCell(cell) instead - no such
problem. It occurs on complex spreadsheets and I was not able to reproduce the
exception reading the same formulas from the same spreadsheets individually.
So, it may be happening as a side effect of sequential bulk reading of a bunch
of formulas (probably in combination with some styles?). Looks like a caching
problem somewhere inside the framework. I'm using the most recent, yesterday's
snapshot (20100419), - to avoid 48026 and few following exceptions.
java.lang.Class - java.lang.NullPointerException
at
org.apache.poi.xssf.usermodel.XSSFCell.convertSharedFormula(XSSFCell.java:369)
at org.apache.poi.xssf.usermodel.XSSFCell.getCellFormula(XSSFCell.java:353)
at
org.apache.poi.xssf.usermodel.XSSFEvaluationWorkbook.getFormulaTokens(XSSFEvaluationWorkbook.java:141)
at
org.apache.poi.ss.formula.WorkbookEvaluator.evaluateAny(WorkbookEvaluator.java:259)
at
org.apache.poi.ss.formula.WorkbookEvaluator.evaluate(WorkbookEvaluator.java:207)
at
org.apache.poi.xssf.usermodel.XSSFFormulaEvaluator.evaluateFormulaCellValue(XSSFFormulaEvaluator.java:252)
at
org.apache.poi.xssf.usermodel.XSSFFormulaEvaluator.evaluateInCell(XSSFFormulaEvaluator.java:173)
at
org.apache.poi.xssf.usermodel.XSSFFormulaEvaluator.evaluateInCell(XSSFFormulaEvaluator.java:46)
at
org.is.jxlpoi.JXLPOIWorkbook.getCellContentAsString(JXLPOIWorkbook.java:137)
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- 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
DO NOT REPLY [Bug 49156] NPE when evaluateInCell is used
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=49156
--- Comment #7 from Vasili <vg...@rogers.com> 2010-05-10 16:00:38 EDT ---
I was able to clean the workbook, isolating the case. Further cleaning
eliminate the problem (although, I believe this state is already fine for you).
Attached:
1) unit test
notice if you will comment-out one line
formulaEvaluator.evaluateInCell(c)
and uncomment:
formulaEvaluator.evaluate(c)
the problem will go away
2) testNPE.xlsx
Notice that if you will remove all rows from the beginning - the problem will
go away. The same - if you will not read the first value, which is determined
as a formula, although it is not actually.
Hopefully, this will be helpful
Regards
Vasili
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- 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
DO NOT REPLY [Bug 49156] NPE when evaluateInCell is used
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=49156
--- Comment #9 from Vasili <vg...@rogers.com> 2010-05-10 16:02:48 EDT ---
Created an attachment (id=25426)
--> (https://issues.apache.org/bugzilla/attachment.cgi?id=25426)
minimal spreadsheet which cases problem
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- 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
DO NOT REPLY [Bug 49156] NPE when evaluateInCell is used
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=49156
--- Comment #4 from Vasili <vg...@rogers.com> 2010-05-10 10:21:11 EDT ---
We are not doing anything special.
The only difference is one line (please make diff).
You can remove switch statement after the call and it will be the same crash,
so the only difference is:
formulaEvaluator.evaluateInCell(c); //crashes with the NPE
or
CellValue cv = formulaEvaluator.evaluate(c); //working
It crashes on all our files. I can't send the file since it is internal. I can
send it to you directly although. But it seems it will not very helpful and
will only confuse since we have thousands of cells and the order of reading is
not sequential, so we'll need somehow to simulate the order etc. May be it is
easier to understand the cause theoretically? If it is not possible, we can
think - how to separate the problem into an individual test case. Let me know -
if you need my help in this.
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- 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
DO NOT REPLY [Bug 49156] NPE when evaluateInCell is used
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=49156
Vasili <vg...@rogers.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Severity|critical |normal
--- Comment #2 from Vasili <vg...@rogers.com> 2010-04-21 14:23:07 EDT ---
I've found a walkaround
(using FormulaEvaluator's evaluate(c), returning a copy of the cell instead),
since it appeared that this method does not give the above-mentioned NPE (at
least for now) and behaves in the same way with both 97/2000 and 2007 Excel
formats.
So, I'm degrading the importance to Normal (but sure, NPE in evaluateInCell is
better to be fixed before the next stable version).
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- 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
DO NOT REPLY [Bug 49156] NPE when evaluateInCell is used
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=49156
Josh Micich <jo...@gildedtree.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |NEEDINFO
--- Comment #3 from Josh Micich <jo...@gildedtree.com> 2010-05-09 12:03:57 EDT ---
We will probably need a copy of the offending xlsx file to diagnose this bug
properly. It's likely that you have found a slightly unusual situation that
Excel perhaps encodes in an unusual way.
The workaround you describe doesn't sound right. If you are doing *any* sort
of formula evaluation, the convertSharedFormula will still need to be called,
and I don't see any reason why it should behave differently depending on
whether you call evaluateInCell() or evaluate(). I have a feeling you might
have done something else that made the problem go away.
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- 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
DO NOT REPLY [Bug 49156] NPE when evaluateInCell is used
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=49156
Yegor Kozlov <ye...@dinom.ru> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
--- Comment #10 from Yegor Kozlov <ye...@dinom.ru> 2010-12-11 08:10:12 EST ---
The problem is not reproducible with current trunk.
Try the latest build, daily builds can be downloaded from here:
http://encore.torchbox.com/poi-cvs-build/
Yegor
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- 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
DO NOT REPLY [Bug 49156] NPE when evaluateInCell is used
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=49156
--- Comment #8 from Vasili <vg...@rogers.com> 2010-05-10 16:01:29 EDT ---
Created an attachment (id=25425)
--> (https://issues.apache.org/bugzilla/attachment.cgi?id=25425)
testcase
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- 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
DO NOT REPLY [Bug 49156] NPE when evaluateInCell is used
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=49156
--- Comment #1 from Vasili <vg...@rogers.com> 2010-04-20 15:48:34 EDT ---
Exception occurs only when reading Excel 2007 files. When using the same
spreadsheet but been saved as 97/2000 Excel format (the same formulas) and so
HSSF is used internally - everything is fine. (but we need to process files
been saved by default as 2007+ as well!)
I've tried to use evaluateFormulaCell() instead, but the formulas results are
different (we have a bunch of regression tests using aggregate functions such
as calculating of the sum of all formulas sums etc) than using
evaluateInCell(). The later calculates correctly but due to the NPE mentioned
above - it works for 97/2000 Excel files only. I'm expecting it to work in the
same way (with the same results) - for 2007 format.
That is why I'm waiting for NPE fix - for evaluateInCell() and can't use
evaluateFormulaCell().
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- 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
DO NOT REPLY [Bug 49156] NPE when evaluateInCell is used
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=49156
Vasili <vg...@rogers.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEEDINFO |NEW
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- 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
DO NOT REPLY [Bug 49156] NPE when evaluateInCell is used
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=49156
--- Comment #5 from Vasili <vg...@rogers.com> 2010-05-10 10:22:17 EDT ---
Created an attachment (id=25420)
--> (https://issues.apache.org/bugzilla/attachment.cgi?id=25420)
not working case
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- 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
DO NOT REPLY [Bug 49156] NPE when evaluateInCell is used
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=49156
--- Comment #6 from Vasili <vg...@rogers.com> 2010-05-10 10:22:42 EDT ---
Created an attachment (id=25421)
--> (https://issues.apache.org/bugzilla/attachment.cgi?id=25421)
working case
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- 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