Skip to content

Commit

Permalink
MOSIP-25073:Added the code fix for bugs in sonar analysis of admin-se…
Browse files Browse the repository at this point in the history
…rvices

Signed-off-by: Yash S <[email protected]>
  • Loading branch information
yashmsonkusare committed Mar 12, 2024
1 parent 66a0f78 commit 1c4be52
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,8 @@ public <T> T getApi(String url,
try {
ResponseEntity responseEntity= (ResponseEntity) restTemplate
.exchange(url, HttpMethod.GET, setRequestHeader(null, null), responseType);
if(url.contains("datashare") && responseEntity.getHeaders().getContentType().equals(MediaType.APPLICATION_JSON)){
MediaType contentType = responseEntity.getHeaders().getContentType();
if(url.contains("datashare") && contentType == null || contentType.equals(MediaType.APPLICATION_JSON)){
throw new MasterDataServiceException(ApplicantDetailErrorCode.DATA_SHARE_EXPIRED_EXCEPTION.getErrorCode(),
ApplicantDetailErrorCode.DATA_SHARE_EXPIRED_EXCEPTION.getErrorMessage());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,12 +110,16 @@ public ApplicantDetailsDto getApplicantDetails(String rid) throws Exception {
JSONObject mapperIdentity=utility.getJSONObject(idenitityJsonObject,IDENTITY);
List<String> mapperJsonKeys = new ArrayList<>(mapperIdentity.keySet());
for(String valueObj: applicantDetails){
if(valueObj!=null && !valueObj.equalsIgnoreCase(ApplicantPhoto)){
LinkedHashMap<String, String> jsonObject = utility.getJSONValue(mapperIdentity, valueObj);
String value = jsonObject.get(VALUE);
applicantDataMap.put(value,identityObj.get(value).toString());
} else if (valueObj.equalsIgnoreCase(ApplicantPhoto)) {
getImageData(documents,applicantDataMap);
if(valueObj!=null) {
if (!valueObj.equalsIgnoreCase(ApplicantPhoto)) {
LinkedHashMap<String, String> jsonObject = utility.getJSONValue(mapperIdentity, valueObj);
String value = jsonObject.get(VALUE);
applicantDataMap.put(value, identityObj.get(value).toString());
} else if (valueObj.equalsIgnoreCase(ApplicantPhoto)) {
getImageData(documents, applicantDataMap);
}
} else {
throw new NullPointerException("valueObj is null");
}
}
saveApplicantLoginDetails();
Expand Down

0 comments on commit 1c4be52

Please sign in to comment.