[Bug #663] Fix bug

It was always retrieving end data for AggregateOfResourceAllocations
and that's illegal when the aggregate is empty.

FEA: ItEr61S05BugFixing
This commit is contained in:
Óscar González Fernández 2010-09-27 23:49:45 +02:00
parent e8b77aba32
commit 152e5216ff
2 changed files with 8 additions and 1 deletions

View file

@ -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");

View file

@ -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;
}