From 88324ca452adfc3dae875ef971612332d4318e30 Mon Sep 17 00:00:00 2001 From: Jinil Sung Date: Thu, 6 Jul 2023 15:50:43 -0700 Subject: [PATCH 1/2] GRAD2-2172: bug fix on NPE when retrieving student optional programs. GRAD2-2172: bug fix on NPE when retrieving student optional programs. --- .../process/StudentProcess.java | 30 ++++++++++--------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/api/src/main/java/ca/bc/gov/educ/api/dataconversion/process/StudentProcess.java b/api/src/main/java/ca/bc/gov/educ/api/dataconversion/process/StudentProcess.java index c211ca9a..d9c38560 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/dataconversion/process/StudentProcess.java +++ b/api/src/main/java/ca/bc/gov/educ/api/dataconversion/process/StudentProcess.java @@ -1135,23 +1135,25 @@ public void saveGraduationStudent(StudentGradDTO gradStudent, String accessToken } private void removeAndReCreateOptionalPrograms(StudentGradDTO gradStudent, String accessToken) { - List optionalProgramCodes = new ArrayList<>(); - // Remove all optional programs List studentOptionalPrograms = restUtils.getStudentOptionalPrograms(gradStudent.getStudentID().toString(), accessToken); - studentOptionalPrograms.forEach(op -> { - log.info(" => [{}] optional program will be removed if exist.", op.getOptionalProgramCode()); - removeStudentOptionalProgram(op.getOptionalProgramID(), gradStudent, accessToken); - if (isOptionalProgramRecreationRequired(op.getOptionalProgramCode())) { - optionalProgramCodes.add(op.getOptionalProgramCode()); - } - }); + if (studentOptionalPrograms != null && !studentOptionalPrograms.isEmpty()) { + List optionalProgramCodes = new ArrayList<>(); - // Recreate nonFI & nonDD optional programs - optionalProgramCodes.forEach(opc -> { - log.info(" => [{}] optional program will be re-created.", opc); - addStudentOptionalProgram(opc, gradStudent, true, accessToken); - }); + studentOptionalPrograms.forEach(op -> { + log.info(" => [{}] optional program will be removed if exist.", op.getOptionalProgramCode()); + removeStudentOptionalProgram(op.getOptionalProgramID(), gradStudent, accessToken); + if (isOptionalProgramRecreationRequired(op.getOptionalProgramCode())) { + optionalProgramCodes.add(op.getOptionalProgramCode()); + } + }); + + // Recreate nonFI & nonDD optional programs + optionalProgramCodes.forEach(opc -> { + log.info(" => [{}] optional program will be re-created.", opc); + addStudentOptionalProgram(opc, gradStudent, true, accessToken); + }); + } } private void handleFIorDDOptionalProgram(StudentGradDTO gradStudent, String accessToken) { From c22f3d1758614a653cad4a74a3f7fcd68ab9a410 Mon Sep 17 00:00:00 2001 From: Kamal Mohammed Date: Thu, 6 Jul 2023 17:34:20 -0600 Subject: [PATCH 2/2] Update pom.xml --- api/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/pom.xml b/api/pom.xml index d00351a6..77e75ea4 100644 --- a/api/pom.xml +++ b/api/pom.xml @@ -6,7 +6,7 @@ ca.bc.gov.educ educ-grad-data-conversion-api - 1.8.44 + 1.8.45 educ-grad-data-conversion-api Ministry of Education GRAD DATA CONVERSION API