Summary: | [PATCH] NullPointerException in FormulaRecord | ||
---|---|---|---|
Product: | POI | Reporter: | Dennis Doubleday <dennis> |
Component: | HSSF | Assignee: | POI Developers List <dev> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | moj |
Priority: | P3 | ||
Version: | 2.0-dev | ||
Target Milestone: | --- | ||
Hardware: | PC | ||
OS: | All | ||
Attachments: |
Excel document that caused the bug report
Patch file that fixes the problem |
Description
Dennis Doubleday
2002-09-27 14:01:24 UTC
Created attachment 3259 [details]
Excel document that caused the bug report
I found what causes the NPE. In FormulaRecord.fillFields(), if an UnsupportedOperationException is thrown while parsing, the field field_8_parsed_expr is set to null, but then the following appears in FormulaRecord.toString() (line 548): buffer.append(" .numptgsinarray = ").append(field_8_parsed_expr.size()) .append("\n"); for (int k = 0; k < field_8_parsed_expr.size(); k++ ) { Either reference to field_8_parsed_expr.size() will cause an NPE because the field was set to null. Created attachment 3821 [details]
Patch file that fixes the problem
Patch attached. Note that this patch means that BiffViewer will not fail with an exception when a formula doesn't parse--you'll just see a WARNING in the output. Maybe that means you want to change BiffViewer, but this is the right patch for this problem, anyway. applied and committed. Please crosscheck. It would be good if we could signal an error in a recoverable way. |