Error generating split TimePhased as day when having baseline with work and calendar exceptions
Closed this issue · 3 comments
When I have an MSProject schedule with work and in this schedule I have some calendar exception (holiday or day off), if I try to run the code below:
MSPDIWriter writer = new MSPDIWriter();
writer.setWriteTimephasedData(true);
writer.setSplitTimephasedAsDays(true);
writer.write(mpx, "D:/output.xml");
I get the following error:
java.lang.NullPointerException: time at java.util.Objects.requireNonNull(Objects.java:228) at java.time.LocalDateTime.of(LocalDateTime.java:375) at net.sf.mpxj.mspdi.MSPDIWriter.splitDays(MSPDIWriter.java:2295) at net.sf.mpxj.mspdi.MSPDIWriter.writeAssignmentTimephasedData(MSPDIWriter.java:2218) at net.sf.mpxj.mspdi.MSPDIWriter.writeAssignment(MSPDIWriter.java:2064) at net.sf.mpxj.mspdi.MSPDIWriter.lambda$26(MSPDIWriter.java:1932)
inspecting the code I noticed that when trying to generate TimePhased as Day, in the baseline, when I have an exception there is a null return for the LocalDateTime.of function.
As a reference we have the MSPDIWriter.java file and the error occurs when generating the baseline per job, line 2218:
When execute the function getStartTime in ProjectCalendar.java and i have any task with start and end date between calendar exception in baseline with work the result of line 568 is a rages.isEmpty() == true
and pass a null value as return and throw the application exception.
The file msproject_1.mpp
is a simple schedulte without work.
The file msproject_2.mpp
is the same but i had defide a work and baseline after.
I would like support in checking this item. Am I doing something wrong or is it a bug?
I also noticed that, in order to stop the error in the second msproject_2.mpp file, I need to, in addition to resetting the work and resetting the baseline, hide the work columns.
More one information. I run the same schedule in version 11.5.x and work correctly.
I've fixed this issue, the changes have been merged and will form part of the next release (hopefully this week!)
Thanks Jon Iles!