[Bug 61652] New: Attempting to getConditionalFormattingForCell causes NPE

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[Bug 61652] New: Attempting to getConditionalFormattingForCell causes NPE

Bugzilla from bugzilla@apache.org
https://bz.apache.org/bugzilla/show_bug.cgi?id=61652

            Bug ID: 61652
           Summary: Attempting to getConditionalFormattingForCell causes
                    NPE
           Product: POI
           Version: 3.17-FINAL
          Hardware: PC
            Status: NEW
          Severity: normal
          Priority: P2
         Component: XSSF
          Assignee: [hidden email]
          Reporter: [hidden email]
  Target Milestone: ---

Created attachment 35449
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=35449&action=edit
The errant spreadsheet...

In the attached spreadsheet, an attempt to fetch the conditional formatting for
cell IRPPCalc!S12.

This is the code:

public class Main {
    public static void main(String[] args) {
            try {
                Workbook wb = WorkbookFactory.create(new
File("condfail.xlsx"));
                Sheet sheet = (wb.getSheet("IRPPCalc"));
                Row row = (sheet.getRow(11));
                XSSFCell cell = (XSSFCell) row.getCell(18);
                WorkbookEvaluatorProvider fe = (WorkbookEvaluatorProvider)
wb.getCreationHelper().createFormulaEvaluator();
                ConditionalFormattingEvaluator condfmt = new
ConditionalFormattingEvaluator(wb, fe);
                System.out.println(">>>>" +
condfmt.getConditionalFormattingForCell(cell));
            } catch(Exception e) {e.printStackTrace();};
    }
}

This is the resultant stack trace:

java.lang.NullPointerException
        at java.util.Calendar.setTime(Calendar.java:1770)
        at org.apache.poi.ss.formula.functions.EDate.evaluate(EDate.java:49)
        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:514)
        at
org.apache.poi.ss.formula.WorkbookEvaluator.evaluateAny(WorkbookEvaluator.java:278)
        at
org.apache.poi.ss.formula.WorkbookEvaluator.evaluateReference(WorkbookEvaluator.java:722)
        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.WorkbookEvaluator.dereferenceResult(WorkbookEvaluator.java:589)
        at
org.apache.poi.ss.formula.WorkbookEvaluator.evaluateFormula(WorkbookEvaluator.java:536)
        at
org.apache.poi.ss.formula.WorkbookEvaluator.evaluateAny(WorkbookEvaluator.java:278)
        at
org.apache.poi.ss.formula.WorkbookEvaluator.evaluateReference(WorkbookEvaluator.java:722)
        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:65)
        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:514)
        at
org.apache.poi.ss.formula.WorkbookEvaluator.evaluateAny(WorkbookEvaluator.java:278)
        at
org.apache.poi.ss.formula.WorkbookEvaluator.evaluateReference(WorkbookEvaluator.java:722)
        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.WorkbookEvaluator.dereferenceResult(WorkbookEvaluator.java:589)
        at
org.apache.poi.ss.formula.WorkbookEvaluator.evaluateFormula(WorkbookEvaluator.java:536)
        at
org.apache.poi.ss.formula.WorkbookEvaluator.evaluateAny(WorkbookEvaluator.java:278)
        at
org.apache.poi.ss.formula.WorkbookEvaluator.evaluateReference(WorkbookEvaluator.java:722)
        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:514)
        at
org.apache.poi.ss.formula.WorkbookEvaluator.evaluateNameFormula(WorkbookEvaluator.java:711)
        at
org.apache.poi.ss.formula.WorkbookEvaluator.evaluate(WorkbookEvaluator.java:803)
        at
org.apache.poi.ss.formula.WorkbookEvaluator.evaluate(WorkbookEvaluator.java:772)
        at
org.apache.poi.ss.formula.EvaluationConditionalFormatRule.checkFormula(EvaluationConditionalFormatRule.java:378)
        at
org.apache.poi.ss.formula.EvaluationConditionalFormatRule.matches(EvaluationConditionalFormatRule.java:306)
        at
org.apache.poi.ss.formula.ConditionalFormattingEvaluator.getConditionalFormattingForCell(ConditionalFormattingEvaluator.java:176)
        at
org.apache.poi.ss.formula.ConditionalFormattingEvaluator.getConditionalFormattingForCell(ConditionalFormattingEvaluator.java:206)
        at com.fidnip.Main.main(Main.java:29)

--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

[Bug 61652] Attempting to getConditionalFormattingForCell causes NPE

Bugzilla from bugzilla@apache.org
https://bz.apache.org/bugzilla/show_bug.cgi?id=61652

Blake <[hidden email]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 OS|                            |All

--- Comment #1 from Blake <[hidden email]> ---
Sorry, that should've been a little clearer:

"In the attached spreadsheet, an attempt to fetch the conditional formatting
for cell IRPPCalc!S12."

should be:

"In the attached spreadsheet, an attempt to fetch the conditional formatting
for cell IRPPCalc!S12 results in a Null Pointer Error in the
java.util.Calendar.setTime function."

--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]