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 2017/03/13 20:09:38 UTC

[Bug 60858] New: Sumifs throws NullPointerException

https://bz.apache.org/bugzilla/show_bug.cgi?id=60858

            Bug ID: 60858
           Summary: Sumifs throws NullPointerException
           Product: POI
           Version: 3.15-dev
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: SS Common
          Assignee: dev@poi.apache.org
          Reporter: daniel-john@gmx.net
                CC: czamarth@gmail.com, dev@poi.apache.org,
                    kameda.sbng@gmail.com
        Depends on: 56420
  Target Milestone: ---

+++ This bug was initially created as a clone of Bug #56420 +++

When I use SUMIFS function in xlsx file.
If predicate value is cell and cell value is null,
org.apache.poi.ss.formula.functions.Sumifs.accumulate method throws
NullPointerException.

This is stack trace:

java.lang.NullPointerException
at org.apache.poi.ss.formula.functions.Sumifs.sumMatchingCells(Sumifs.java:138)
at org.apache.poi.ss.formula.functions.Sumifs.evaluate(Sumifs.java:79)
at
org.apache.poi.ss.formula.UserDefinedFunction.evaluate(UserDefinedFunction.java:61)
at
org.apache.poi.ss.formula.OperationEvaluatorFactory.evaluate(OperationEvaluatorFactory.java:129)
at
org.apache.poi.ss.formula.WorkbookEvaluator.evaluateFormula(WorkbookEvaluator.java:550)
at
org.apache.poi.ss.formula.WorkbookEvaluator.evaluateAny(WorkbookEvaluator.java:317)
at
org.apache.poi.ss.formula.WorkbookEvaluator.evaluate(WorkbookEvaluator.java:259)
at
org.apache.poi.xssf.usermodel.BaseXSSFFormulaEvaluator.evaluateFormulaCellValue(BaseXSSFFormulaEvaluator.java:65)
at
org.apache.poi.ss.formula.BaseFormulaEvaluator.evaluateFormulaCellEnum(BaseFormulaEvaluator.java:193)
at
org.apache.poi.ss.formula.BaseFormulaEvaluator.evaluateAllFormulaCells(BaseFormulaEvaluator.java:268)
at
org.apache.poi.xssf.usermodel.XSSFFormulaEvaluator.evaluateAll(XSSFFormulaEvaluator.java:92)

And this is the code that throws NullPointerException:

if (!mp.matches(aeRange.getRelativeValue(r, c))) {
                        matches = false;
                        break;
                    }

It is the same problem as in Bug #56420.


Referenced Bugs:

https://bz.apache.org/bugzilla/show_bug.cgi?id=56420
[Bug 56420] Sumif throws NullPointerException
-- 
You are receiving this mail because:
You are on the CC list for the bug.
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


[Bug 60858] Sumifs throws NullPointerException

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=60858

--- Comment #1 from Greg Woolsey <gw...@apache.org> ---
Can you try with the latest 3.16 nightly?  I suspect I fixed this when I
completely redid SUMIFS() and COUNTIFS() for 

https://bz.apache.org/bugzilla/show_bug.cgi?id=56822

in commit r1783037.

-- 
You are receiving this mail because:
You are the assignee for the bug.
You are on the CC list for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 60858] Sumifs throws NullPointerException

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=60858

--- Comment #2 from Daniel John <da...@gmx.net> ---
Problem is still there:

Error while evaluating formula:IF(Q2="LT",SUMIFS(O2:O1,N2:N1,N2,A2:A1,A2)," ")
java.lang.NullPointerException
at
org.apache.poi.ss.formula.functions.Baseifs.aggregateMatchingCells(Baseifs.java:138)
at org.apache.poi.ss.formula.functions.Baseifs.evaluate(Baseifs.java:70)
at org.apache.poi.ss.formula.functions.Sumifs.evaluate(Sumifs.java:42)
at
org.apache.poi.ss.formula.UserDefinedFunction.evaluate(UserDefinedFunction.java:61)
at
org.apache.poi.ss.formula.OperationEvaluatorFactory.evaluate(OperationEvaluatorFactory.java:129)
at
org.apache.poi.ss.formula.WorkbookEvaluator.evaluateFormula(WorkbookEvaluator.java:523)
at
org.apache.poi.ss.formula.WorkbookEvaluator.evaluateAny(WorkbookEvaluator.java:290)
at
org.apache.poi.ss.formula.WorkbookEvaluator.evaluate(WorkbookEvaluator.java:232)
at
org.apache.poi.xssf.usermodel.BaseXSSFFormulaEvaluator.evaluateFormulaCellValue(BaseXSSFFormulaEvaluator.java:65)
at
org.apache.poi.ss.formula.BaseFormulaEvaluator.evaluateInCell(BaseFormulaEvaluator.java:137)
at
org.apache.poi.xssf.usermodel.XSSFFormulaEvaluator.evaluateInCell(XSSFFormulaEvaluator.java:77)
at com.decadis.jira.xport.Exporter.createXSSFWorkbook2_0(Exporter.java:169)
at
com.decadis.jira.xport.rest.QuickExportRest.getWorkbook(QuickExportRest.java:310)
at
com.decadis.jira.xport.rest.QuickExportRest.access$0(QuickExportRest.java:238)
at com.decadis.jira.xport.rest.QuickExportRest$1.write(QuickExportRest.java:94)

But the file I have produces more than one failure....

I will attach it.

-- 
You are receiving this mail because:
You are the assignee for the bug.
You are on the CC list for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 60858] Sumifs throws NullPointerException

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=60858

Daniel John <da...@gmx.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |daniel-john@gmx.net

-- 
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


[Bug 60858] Sumifs throws NullPointerException

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=60858

Daniel John <da...@gmx.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Version|3.15-dev                    |3.15-FINAL

-- 
You are receiving this mail because:
You are on the CC list for the bug.
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


[Bug 60858] Sumifs throws NullPointerException

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=60858

Greg Woolsey <gw...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|NEW                         |RESOLVED

--- Comment #4 from Greg Woolsey <gw...@apache.org> ---
Thank you for the test file and stack trace.  I was able to confirm the
regression introduced by the refactoring to fix #56822, add your file as a unit
test, and fix the bug in r1786953.

-- 
You are receiving this mail because:
You are the assignee for the bug.
You are on the CC list for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 60858] Sumifs throws NullPointerException

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=60858

--- Comment #5 from Daniel John <da...@gmx.net> ---
Hi Greg,

great Job! Thank you!

-- 
You are receiving this mail because:
You are the assignee for the bug.
You are on the CC list for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 60858] Sumifs throws NullPointerException

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=60858

--- Comment #3 from Daniel John <da...@gmx.net> ---
Created attachment 34823
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=34823&action=edit
Complex sheet producing a lot of errors while evaluating

Complex sheet producing a lot of errors while evaluating:

Error while evaluating formula:IF(Q2="LT",SUMIFS(O2:O1,N2:N1,N2,A2:A1,A2)," ")
java.lang.NullPointerException
at
org.apache.poi.ss.formula.functions.Baseifs.aggregateMatchingCells(Baseifs.java:138)
at org.apache.poi.ss.formula.functions.Baseifs.evaluate(Baseifs.java:70)
at org.apache.poi.ss.formula.functions.Sumifs.evaluate(Sumifs.java:42)
at
org.apache.poi.ss.formula.UserDefinedFunction.evaluate(UserDefinedFunction.java:61)
at
org.apache.poi.ss.formula.OperationEvaluatorFactory.evaluate(OperationEvaluatorFactory.java:129)
at
org.apache.poi.ss.formula.WorkbookEvaluator.evaluateFormula(WorkbookEvaluator.java:523)
at
org.apache.poi.ss.formula.WorkbookEvaluator.evaluateAny(WorkbookEvaluator.java:290)
at
org.apache.poi.ss.formula.WorkbookEvaluator.evaluate(WorkbookEvaluator.java:232)
at
org.apache.poi.xssf.usermodel.BaseXSSFFormulaEvaluator.evaluateFormulaCellValue(BaseXSSFFormulaEvaluator.java:65)
at
org.apache.poi.ss.formula.BaseFormulaEvaluator.evaluateInCell(BaseFormulaEvaluator.java:137)
at
org.apache.poi.xssf.usermodel.XSSFFormulaEvaluator.evaluateInCell(XSSFFormulaEvaluator.java:77)

--------------------------

Error while evaluating formula:IF(Q2="LT",SUMIFS(E2:E1,N2:N1,N2,A2:A1,A2)-X2,"
")
java.lang.NullPointerException
at
org.apache.poi.ss.formula.functions.Baseifs.aggregateMatchingCells(Baseifs.java:138)
at org.apache.poi.ss.formula.functions.Baseifs.evaluate(Baseifs.java:70)
at org.apache.poi.ss.formula.functions.Sumifs.evaluate(Sumifs.java:42)
at
org.apache.poi.ss.formula.UserDefinedFunction.evaluate(UserDefinedFunction.java:61)
at
org.apache.poi.ss.formula.OperationEvaluatorFactory.evaluate(OperationEvaluatorFactory.java:129)
at
org.apache.poi.ss.formula.WorkbookEvaluator.evaluateFormula(WorkbookEvaluator.java:523)
at
org.apache.poi.ss.formula.WorkbookEvaluator.evaluateAny(WorkbookEvaluator.java:290)
at
org.apache.poi.ss.formula.WorkbookEvaluator.evaluate(WorkbookEvaluator.java:232)
at
org.apache.poi.xssf.usermodel.BaseXSSFFormulaEvaluator.evaluateFormulaCellValue(BaseXSSFFormulaEvaluator.java:65)
at
org.apache.poi.ss.formula.BaseFormulaEvaluator.evaluateInCell(BaseFormulaEvaluator.java:137)
at
org.apache.poi.xssf.usermodel.XSSFFormulaEvaluator.evaluateInCell(XSSFFormulaEvaluator.java:77)


-----------------
Error while evaluating formula:IF(V2=0,IF(Q2<>"LT"," ",IF(G2<=6,"
",IF(AND(G2<=9,F2>=0.02)," ",IF(F2>=0.03," ","zu kurze Pausen"))))," ")
java.lang.NullPointerException
at
org.apache.poi.ss.formula.functions.Baseifs.aggregateMatchingCells(Baseifs.java:138)
at org.apache.poi.ss.formula.functions.Baseifs.evaluate(Baseifs.java:70)
at org.apache.poi.ss.formula.functions.Sumifs.evaluate(Sumifs.java:42)
at
org.apache.poi.ss.formula.UserDefinedFunction.evaluate(UserDefinedFunction.java:61)
at
org.apache.poi.ss.formula.OperationEvaluatorFactory.evaluate(OperationEvaluatorFactory.java:129)
at
org.apache.poi.ss.formula.WorkbookEvaluator.evaluateFormula(WorkbookEvaluator.java:523)
at
org.apache.poi.ss.formula.WorkbookEvaluator.evaluateAny(WorkbookEvaluator.java:290)
at
org.apache.poi.ss.formula.WorkbookEvaluator.evaluateReference(WorkbookEvaluator.java:723)
at
org.apache.poi.ss.formula.SheetRefEvaluator.getEvalForCell(SheetRefEvaluator.java:48)
at
org.apache.poi.ss.formula.SheetRangeEvaluator.getEvalForCell(SheetRangeEvaluator.java:74)
at org.apache.poi.ss.formula.LazyRefEval.getInnerValueEval(LazyRefEval.java:39)
at
org.apache.poi.ss.formula.eval.OperandResolver.chooseSingleElementFromRef(OperandResolver.java:179)
at
org.apache.poi.ss.formula.eval.OperandResolver.getSingleValue(OperandResolver.java:62)
at
org.apache.poi.ss.formula.eval.RelationalOperationEval.evaluate(RelationalOperationEval.java:64)
at
org.apache.poi.ss.formula.functions.Fixed2ArgFunction.evaluate(Fixed2ArgFunction.java:33)
at
org.apache.poi.ss.formula.OperationEvaluatorFactory.evaluate(OperationEvaluatorFactory.java:119)
at
org.apache.poi.ss.formula.WorkbookEvaluator.evaluateFormula(WorkbookEvaluator.java:523)
at
org.apache.poi.ss.formula.WorkbookEvaluator.evaluateAny(WorkbookEvaluator.java:290)
at
org.apache.poi.ss.formula.WorkbookEvaluator.evaluate(WorkbookEvaluator.java:232)
at
org.apache.poi.xssf.usermodel.BaseXSSFFormulaEvaluator.evaluateFormulaCellValue(BaseXSSFFormulaEvaluator.java:65)
at
org.apache.poi.ss.formula.BaseFormulaEvaluator.evaluateInCell(BaseFormulaEvaluator.java:137)
at
org.apache.poi.xssf.usermodel.XSSFFormulaEvaluator.evaluateInCell(XSSFFormulaEvaluator.java:77)

----------------------------

Error while evaluating formula:IF(G2<>" ",IF(G2>10,G2-10," ")," ")
java.lang.NullPointerException
at
org.apache.poi.ss.formula.functions.Baseifs.aggregateMatchingCells(Baseifs.java:138)
at org.apache.poi.ss.formula.functions.Baseifs.evaluate(Baseifs.java:70)
at org.apache.poi.ss.formula.functions.Sumifs.evaluate(Sumifs.java:42)
at
org.apache.poi.ss.formula.UserDefinedFunction.evaluate(UserDefinedFunction.java:61)
at
org.apache.poi.ss.formula.OperationEvaluatorFactory.evaluate(OperationEvaluatorFactory.java:129)
at
org.apache.poi.ss.formula.WorkbookEvaluator.evaluateFormula(WorkbookEvaluator.java:523)
at
org.apache.poi.ss.formula.WorkbookEvaluator.evaluateAny(WorkbookEvaluator.java:290)
at
org.apache.poi.ss.formula.WorkbookEvaluator.evaluateReference(WorkbookEvaluator.java:723)
at
org.apache.poi.ss.formula.SheetRefEvaluator.getEvalForCell(SheetRefEvaluator.java:48)
at
org.apache.poi.ss.formula.SheetRangeEvaluator.getEvalForCell(SheetRangeEvaluator.java:74)
at org.apache.poi.ss.formula.LazyRefEval.getInnerValueEval(LazyRefEval.java:39)
at
org.apache.poi.ss.formula.eval.OperandResolver.chooseSingleElementFromRef(OperandResolver.java:179)
at
org.apache.poi.ss.formula.eval.OperandResolver.getSingleValue(OperandResolver.java:62)
at
org.apache.poi.ss.formula.eval.RelationalOperationEval.evaluate(RelationalOperationEval.java:64)
at
org.apache.poi.ss.formula.functions.Fixed2ArgFunction.evaluate(Fixed2ArgFunction.java:33)
at
org.apache.poi.ss.formula.OperationEvaluatorFactory.evaluate(OperationEvaluatorFactory.java:119)
at
org.apache.poi.ss.formula.WorkbookEvaluator.evaluateFormula(WorkbookEvaluator.java:523)
at
org.apache.poi.ss.formula.WorkbookEvaluator.evaluateAny(WorkbookEvaluator.java:290)
at
org.apache.poi.ss.formula.WorkbookEvaluator.evaluate(WorkbookEvaluator.java:232)
at
org.apache.poi.xssf.usermodel.BaseXSSFFormulaEvaluator.evaluateFormulaCellValue(BaseXSSFFormulaEvaluator.java:65)
at
org.apache.poi.ss.formula.BaseFormulaEvaluator.evaluateInCell(BaseFormulaEvaluator.java:137)
at
org.apache.poi.xssf.usermodel.XSSFFormulaEvaluator.evaluateInCell(XSSFFormulaEvaluator.java:77)

------------------------------

-- 
You are receiving this mail because:
You are on the CC list for the bug.
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