From f07ce4fccd02d1fde6b1b5821dcdf1f6d707921d Mon Sep 17 00:00:00 2001 From: Manuel Rego Casasnovas Date: Fri, 27 Apr 2012 12:03:19 +0200 Subject: [PATCH] Bug #1412: Avoid NPE if clockStart and clockFinish are not defined FEA: ItEr76S04BugFixing --- .../business/reports/dtos/HoursWorkedPerResourceDTO.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/libreplan-business/src/main/java/org/libreplan/business/reports/dtos/HoursWorkedPerResourceDTO.java b/libreplan-business/src/main/java/org/libreplan/business/reports/dtos/HoursWorkedPerResourceDTO.java index 9fce1dfc6..a77bae0d4 100644 --- a/libreplan-business/src/main/java/org/libreplan/business/reports/dtos/HoursWorkedPerResourceDTO.java +++ b/libreplan-business/src/main/java/org/libreplan/business/reports/dtos/HoursWorkedPerResourceDTO.java @@ -25,6 +25,7 @@ import java.util.Date; import java.util.Set; import org.joda.time.LocalDate; +import org.joda.time.LocalTime; import org.libreplan.business.labels.entities.Label; import org.libreplan.business.resources.entities.Resource; import org.libreplan.business.workingday.EffortDuration; @@ -58,8 +59,12 @@ public class HoursWorkedPerResourceDTO implements Comparable { this.workerName = resource.getName(); this.date = workReportLine.getDate(); - this.clockStart = workReportLine.getClockStart().toString("HH:mm"); - this.clockFinish = workReportLine.getClockFinish().toString("HH:mm"); + LocalTime clockStart = workReportLine.getClockStart(); + this.clockStart = (clockStart != null) ? clockStart.toString("HH:mm") + : ""; + LocalTime clockFinish = workReportLine.getClockFinish(); + this.clockFinish = (clockFinish != null) ? clockFinish + .toString("HH:mm") : ""; this.effort = workReportLine.getEffort(); this.orderElementCode = workReportLine.getOrderElement().getCode(); this.orderElementName = workReportLine.getOrderElement().getName();