Fix NullPointerException try to convert null LocalDate to Date in TaskStartConstraint
Select a new StartConstraintType in TaskProperties lunches a NullPointerException FEA: ItEr61S05BugFixing
This commit is contained in:
parent
88a2929a75
commit
1ee7b2d536
3 changed files with 10 additions and 8 deletions
|
|
@ -19,6 +19,8 @@
|
|||
*/
|
||||
package org.navalplanner.business.planner.entities;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.joda.time.LocalDate;
|
||||
|
||||
|
|
@ -41,6 +43,11 @@ public class TaskStartConstraint {
|
|||
: StartConstraintType.AS_SOON_AS_POSSIBLE;
|
||||
}
|
||||
|
||||
public Date getConstraintDateAsDate() {
|
||||
return constraintDate != null ? constraintDate.toDateTimeAtStartOfDay()
|
||||
.toDate() : null;
|
||||
}
|
||||
|
||||
public void explicityMovedTo(LocalDate date) {
|
||||
Validate.notNull(date);
|
||||
startConstraintType = startConstraintType.newTypeAfterMoved();
|
||||
|
|
|
|||
|
|
@ -449,12 +449,8 @@ public class EditTaskController extends GenericForwardComposer {
|
|||
if ((taskElement == null) || (!isTaskLeafConstraint())) {
|
||||
return null;
|
||||
}
|
||||
LocalDate constraintDate = ((ITaskLeafConstraint) taskElement)
|
||||
.getStartConstraint().getConstraintDate();
|
||||
if(constraintDate == null) {
|
||||
return null;
|
||||
}
|
||||
return constraintDate.toDateTimeAtStartOfDay().toDate();
|
||||
return ((ITaskLeafConstraint) taskElement).getStartConstraint()
|
||||
.getConstraintDateAsDate();
|
||||
}
|
||||
|
||||
private boolean isTaskLeafConstraint() {
|
||||
|
|
|
|||
|
|
@ -294,8 +294,7 @@ public class TaskPropertiesController extends GenericForwardComposer {
|
|||
startConstraintDate.setVisible(constraint.isAssociatedDateRequired());
|
||||
TaskStartConstraint taskStartConstraint = currentTaskElementAsTaskLeafConstraint()
|
||||
.getStartConstraint();
|
||||
startConstraintDate.setValue(taskStartConstraint.getConstraintDate()
|
||||
.toDateTimeAtStartOfDay().toDate());
|
||||
startConstraintDate.setValue(taskStartConstraint.getConstraintDateAsDate());
|
||||
}
|
||||
|
||||
private boolean saveConstraintChanges() {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue