From 152e5216ff9010d0d30560beca860b3d0fd62990 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=93scar=20Gonz=C3=A1lez=20Fern=C3=A1ndez?= Date: Mon, 27 Sep 2010 23:49:45 +0200 Subject: [PATCH] [Bug #663] Fix bug It was always retrieving end data for AggregateOfResourceAllocations and that's illegal when the aggregate is empty. FEA: ItEr61S05BugFixing --- .../planner/entities/AggregateOfResourceAllocations.java | 7 +++++++ .../web/planner/allocation/AllocationResult.java | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/navalplanner-business/src/main/java/org/navalplanner/business/planner/entities/AggregateOfResourceAllocations.java b/navalplanner-business/src/main/java/org/navalplanner/business/planner/entities/AggregateOfResourceAllocations.java index 2593ebb6e..e09c79186 100644 --- a/navalplanner-business/src/main/java/org/navalplanner/business/planner/entities/AggregateOfResourceAllocations.java +++ b/navalplanner-business/src/main/java/org/navalplanner/business/planner/entities/AggregateOfResourceAllocations.java @@ -103,6 +103,13 @@ public class AggregateOfResourceAllocations { return end != null ? end.getDate() : null; } + /** + * Calculates the latest end of all the allocations of this aggregate + * + * @return + * @throws IllegalStateException + * if the aggregate is empty + */ public IntraDayDate getEnd() { if (isEmpty()) { throw new IllegalStateException("the aggregate is empty"); diff --git a/navalplanner-webapp/src/main/java/org/navalplanner/web/planner/allocation/AllocationResult.java b/navalplanner-webapp/src/main/java/org/navalplanner/web/planner/allocation/AllocationResult.java index 5017af194..07d094fc7 100644 --- a/navalplanner-webapp/src/main/java/org/navalplanner/web/planner/allocation/AllocationResult.java +++ b/navalplanner-webapp/src/main/java/org/navalplanner/web/planner/allocation/AllocationResult.java @@ -103,7 +103,7 @@ public class AllocationResult { this.aggregate = aggregate; this.daysDuration = aggregate.isEmpty() ? task.getDaysDuration() : aggregate.getDaysDuration(); - this.end = aggregate.getEnd(); + this.end = aggregate.isEmpty() ? null : aggregate.getEnd(); this.newAllocations = newAllocations; this.modified = modified; }