diff --git a/navalplanner-business/src/main/resources/org/navalplanner/business/planner/entities/ResourceAllocations.hbm.xml b/navalplanner-business/src/main/resources/org/navalplanner/business/planner/entities/ResourceAllocations.hbm.xml
index 5c0b3f6af..21dc1964a 100644
--- a/navalplanner-business/src/main/resources/org/navalplanner/business/planner/entities/ResourceAllocations.hbm.xml
+++ b/navalplanner-business/src/main/resources/org/navalplanner/business/planner/entities/ResourceAllocations.hbm.xml
@@ -12,7 +12,7 @@
-
+
diff --git a/navalplanner-webapp/src/main/java/org/navalplanner/web/planner/ResourceAllocationController.java b/navalplanner-webapp/src/main/java/org/navalplanner/web/planner/ResourceAllocationController.java
index 446490e4c..60cd92967 100644
--- a/navalplanner-webapp/src/main/java/org/navalplanner/web/planner/ResourceAllocationController.java
+++ b/navalplanner-webapp/src/main/java/org/navalplanner/web/planner/ResourceAllocationController.java
@@ -307,6 +307,8 @@ public class ResourceAllocationController extends GenericForwardComposer {
// Set percentage
BigDecimal percentage = resourceAllocation.getPercentage();
if (!new BigDecimal(0).equals(resourceAllocation.getPercentage())) {
+ percentage = (percentage != null) ? percentage
+ : new BigDecimal(0);
percentage = percentage.scaleByPowerOfTen(2).setScale(2,
BigDecimal.ROUND_CEILING);
}
diff --git a/navalplanner-webapp/src/main/java/org/navalplanner/web/planner/ResourceAllocationModel.java b/navalplanner-webapp/src/main/java/org/navalplanner/web/planner/ResourceAllocationModel.java
index 11caccc9c..9108038b4 100644
--- a/navalplanner-webapp/src/main/java/org/navalplanner/web/planner/ResourceAllocationModel.java
+++ b/navalplanner-webapp/src/main/java/org/navalplanner/web/planner/ResourceAllocationModel.java
@@ -237,9 +237,11 @@ public class ResourceAllocationModel implements IResourceAllocationModel {
BigDecimal result = new BigDecimal(0);
for (Iterator i = resourceAllocations.iterator(); i.hasNext();) {
- ResourceAllocation resourceAllocation = (ResourceAllocation) i
- .next();
- result = result.add(resourceAllocation.getPercentage());
+ ResourceAllocation resourceAllocation = (ResourceAllocation) i.next();
+ BigDecimal percentage = (resourceAllocation.getPercentage() != null) ? resourceAllocation
+ .getPercentage()
+ : new BigDecimal(0);
+ result = result.add(percentage);
}
return result;