diff --git a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/BaseRule.java b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/BaseRule.java index d6f7bad..80ca022 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/BaseRule.java +++ b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/BaseRule.java @@ -6,10 +6,13 @@ public abstract class BaseRule implements Rule { Date toLastDayOfMonth(Date date) { - Calendar cal = Calendar.getInstance(); - cal.setTime(date); - cal.set(Calendar.DAY_OF_MONTH, cal.getActualMaximum(Calendar.DAY_OF_MONTH)); - return cal.getTime(); + if(date != null) { + Calendar cal = Calendar.getInstance(); + cal.setTime(date); + cal.set(Calendar.DAY_OF_MONTH, cal.getActualMaximum(Calendar.DAY_OF_MONTH)); + return cal.getTime(); + } + return null; } } diff --git a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/util/RuleEngineApiUtils.java b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/util/RuleEngineApiUtils.java index 749ae5a..472ee9f 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/util/RuleEngineApiUtils.java +++ b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/util/RuleEngineApiUtils.java @@ -181,10 +181,13 @@ public static boolean isCompletedCourse(String finalGrade, Double finalPercentag return false; } - private static Date toLastDayOfMonth(Date date) { - Calendar cal = Calendar.getInstance(); - cal.setTime(date); - cal.set(Calendar.DAY_OF_MONTH, cal.getActualMaximum(Calendar.DAY_OF_MONTH)); - return cal.getTime(); + static Date toLastDayOfMonth(Date date) { + if(date != null) { + Calendar cal = Calendar.getInstance(); + cal.setTime(date); + cal.set(Calendar.DAY_OF_MONTH, cal.getActualMaximum(Calendar.DAY_OF_MONTH)); + return cal.getTime(); + } + return null; } } diff --git a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/util/RuleProcessorRuleUtils.java b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/util/RuleProcessorRuleUtils.java index 233eda0..796f44d 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/util/RuleProcessorRuleUtils.java +++ b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/util/RuleProcessorRuleUtils.java @@ -196,10 +196,13 @@ public static void updateCourseLevelForCLC(List studentCourses, S }); } - private static Date toLastDayOfMonth(Date date) { - Calendar cal = Calendar.getInstance(); - cal.setTime(date); - cal.set(Calendar.DAY_OF_MONTH, cal.getActualMaximum(Calendar.DAY_OF_MONTH)); - return cal.getTime(); + static Date toLastDayOfMonth(Date date) { + if(date != null) { + Calendar cal = Calendar.getInstance(); + cal.setTime(date); + cal.set(Calendar.DAY_OF_MONTH, cal.getActualMaximum(Calendar.DAY_OF_MONTH)); + return cal.getTime(); + } + return null; } }