Fix import of MS Project tasks without start (#119)

Don't fail if a task in an MS Project file does not explicitly
have a start time set.
Tasks do not necessarily have to have start time set,
e.g. the start of parent tasks may be derived from their child
tasks.

The fact that the start element is not mandatory
for each task is also described here:
https://msdn.microsoft.com/en-us/library/office/bb968645%28v=office.14%29.aspx
This commit is contained in:
Michael Weghorn 2016-06-14 23:03:48 +02:00
parent 0cac2742b5
commit 04fc2c4ca3

View file

@ -278,9 +278,13 @@ public class MspImporter {
} else { // normal task
task=new Task();
converter.from(mpxTask, task, state);
long taskStart=((Date)task.getPropertyValue("start")).getTime();
if (earliestTaskStart==-1L || taskStart<earliestTaskStart)
earliestTaskStart=taskStart;
final Date taskStartDate = (Date) task.getPropertyValue("start");
if (taskStartDate != null) {
final long taskStart = taskStartDate.getTime();
if (earliestTaskStart == -1L || taskStart < earliestTaskStart)
earliestTaskStart = taskStart;
}
project.addTask(task,parentTask);