Sounds like an input validation issue with EDate and other similar
functions to me.  With Conditional Formatting I tried to not swallow/ignore
errors in evaluation, exactly because I didn't want to hide bugs like this
appears to be.

Excel seems to assume a double of -1 equals a date of 0/0/1900, which of
course is invalid, but somehow Excel doesn't mind.  Not sure yet what POI
should do with that.  Open to suggestions.

On Mon, Oct 23, 2017 at 2:01 PM Blake Watson <[email protected]> wrote:

> Greg--
>
> >>most of these are long shots, as they only throw an unexpected NPE from
> the
> line you indicate when the input double is -Double.MIN_VALUE.  Probably not
> very helpful.<<
>
> This is exactly right. The error is in EDate.java which is calling
> calendar.setTime(-1).
>
> So, the workbook has a cell, Model!A4 which resolves to a -1 (but not null)
> date. But, when EData calls getJavaDate(-1), that returns "nil" which is
> then passed to calendar.setTime. I'm going to try to really simplify the
> example, which...maybe is only incidental to conditional formatting? Or
> there's something that the conditional formatting isn't catching that it
> should?
>
>
>
> On Mon, Oct 23, 2017 at 9:57 AM, Blake Watson <[email protected]>
> wrote:
>
> > OK: I was not doing it for my example, but adding it in didn't change
> > anything. I am creating a cell object, but I'm not changing any values
> (or
> > formats).
> >
> > I was able to open the file as well, after some fussing around. I think
> it
> > was just something I didn't get about FileInputStream. So I now have the
> > code in Java and with a stack trace. This produces the error. I'll put
> the
> > whole thing up in Bugzilla, then I'll go back and try to find the exact
> > cause.
> >
> > 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();
> >                 System.out.println("&&&&");
> >                 ConditionalFormattingEvaluator condfmt = new
> ConditionalFormattingEvaluator(wb, fe);
> >                 System.out.println(">>>>" +
> condfmt.getConditionalFormattingForCell(cell));
> >             } catch(Exception e) {e.printStackTrace();};
> >     }
> > }
> >
> >
> >
>
>
> --
>
> *Blake Watson*
>
> *PNMAC*
> Application Development Manager
> 5898 Condor Drive
> Moorpark, CA 93021
> (805) 330.4911 x7742 <(805)%20330-4911>
> [email protected]
> www.PennyMacUSA.com <http://www.pennymacusa.com/>
>

Reply via email to