diff --git a/registration-processor/core-processor/registration-processor-uin-generator-stage/src/main/java/io/mosip/registration/processor/stages/uingenerator/stage/UinGeneratorStage.java b/registration-processor/core-processor/registration-processor-uin-generator-stage/src/main/java/io/mosip/registration/processor/stages/uingenerator/stage/UinGeneratorStage.java index 73e2dc70242..a14470e0a58 100644 --- a/registration-processor/core-processor/registration-processor-uin-generator-stage/src/main/java/io/mosip/registration/processor/stages/uingenerator/stage/UinGeneratorStage.java +++ b/registration-processor/core-processor/registration-processor-uin-generator-stage/src/main/java/io/mosip/registration/processor/stages/uingenerator/stage/UinGeneratorStage.java @@ -278,12 +278,21 @@ public MessageDTO process(MessageDTO object) { demographicIdentity.put("UIN", uinField); idResponseDTO = sendIdRepoWithUin(registrationId, registrationStatusDto.getRegistrationType(), demographicIdentity, uinField, description); - if(idResponseDTO.getErrors()!=null && idResponseDTO.getErrors().get(0).getErrorCode().equalsIgnoreCase(INVALID_INPUT_PARAMETER_ERROR_CODE)) { + if (idResponseDTO.getErrors() != null && !idResponseDTO.getErrors().isEmpty() && idResponseDTO + .getErrors().get(0).getErrorCode().equalsIgnoreCase(INVALID_INPUT_PARAMETER_ERROR_CODE)) { for (int i = 0; i < maxRetrycount; i++) { regProcLogger.info(StatusUtil.INVALID_INPUT_PARAMETER.getMessage()+":"+StatusUtil.INVALID_INPUT_PARAMETER.getCode()+", Retrying "+(i+1)+" times"); - idResponseDTO = sendIdRepoWithUin(registrationId, registrationStatusDto.getRegistrationType(), demographicIdentity, + // This log will remove later after testing why iteration is not happening in + // server before this fix + regProcLogger.info(LoggerFileConstant.SESSIONID.toString(), + LoggerFileConstant.REGISTRATIONID.toString(), registrationId, + idResponseDTO.toString()); + idResponseDTO = sendIdRepoWithUin(registrationId, + registrationStatusDto.getRegistrationType(), demographicIdentity, uinField, description); - if (idResponseDTO.getErrors()==null || idResponseDTO.getErrors().get(0).getErrorCode()!=INVALID_INPUT_PARAMETER_ERROR_CODE) + if (idResponseDTO.getErrors() == null || idResponseDTO.getErrors().isEmpty() + || idResponseDTO.getErrors().get(0) + .getErrorCode() != INVALID_INPUT_PARAMETER_ERROR_CODE) break; }