Skip to content

Commit

Permalink
P6: handle invalid calendar exceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
joniles committed Jul 25, 2024
1 parent 30a3c4d commit 09a31f0
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/changes/changes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
<action dev="joniles" type="update">Improve recognition of non-working days when reading calendars certain PMXML files.</action>
<action dev="joniles" type="update">Add support for the Resource Assignment field Remaining Units. (Note: this field defaults to the same value as Units if it is not explicitly populated).</action>
<action dev="joniles" type="update">Ensure the Resource Assignment field Remaining Units is read from and written to P6 schedules.</action>
<action dev="joniles" type="update">Improve handling of invalid calendar exception data when reading P6 schedules from XER files or a P6 database.</action>
</release>
<release date="2024-07-08" version="13.0.2">
<action dev="joniles" type="update">When writing XER files, provide a default value for the Resource ID if it is not populated.</action>
Expand Down
21 changes: 20 additions & 1 deletion src/main/java/net/sf/mpxj/primavera/PrimaveraReader.java
Original file line number Diff line number Diff line change
Expand Up @@ -655,7 +655,26 @@ private void processCalendarExceptions(ProjectCalendar calendar, StructuredTextR
{
for (StructuredTextRecord exception : exceptions.getChildren())
{
long daysFromEpoch = Integer.parseInt(exception.getAttribute("d"));
long daysFromEpoch;

try
{
daysFromEpoch = Integer.parseInt(exception.getAttribute("d"));
}

catch (NumberFormatException ex)
{
if (m_ignoreErrors)
{
m_project.addIgnoredError(ex);
continue;
}
else
{
throw ex;
}
}

LocalDate startEx = EXCEPTION_EPOCH.plusDays(daysFromEpoch);

ProjectCalendarException pce = calendar.addCalendarException(startEx, startEx);
Expand Down

0 comments on commit 09a31f0

Please sign in to comment.