poi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject [Bug 61652] New: Attempting to getConditionalFormattingForCell causes NPE
Date Mon, 23 Oct 2017 17:15:03 GMT
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: dev@poi.apache.org
          Reporter: blake.watson@pnmac.com
  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: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


Mime
View raw message