Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MOSIP-21009,MOSIP-25073:Sonar bug fixes for admin-service #956

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -204,9 +204,14 @@ 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)){
throw new MasterDataServiceException(ApplicantDetailErrorCode.DATA_SHARE_EXPIRED_EXCEPTION.getErrorCode(),
ApplicantDetailErrorCode.DATA_SHARE_EXPIRED_EXCEPTION.getErrorMessage());
MediaType contentType = responseEntity.getHeaders().getContentType();
if (url.contains("datashare")) {
if (contentType == null) {
throw new NullPointerException("Content type is null");
} else if (contentType.equals(MediaType.APPLICATION_JSON)) {
throw new MasterDataServiceException(ApplicantDetailErrorCode.DATA_SHARE_EXPIRED_EXCEPTION.getErrorCode(),
ApplicantDetailErrorCode.DATA_SHARE_EXPIRED_EXCEPTION.getErrorMessage());
}
}
result= (T) responseEntity.getBody();
} catch (Exception e) {
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 {
getImageData(documents, applicantDataMap);
}
} else {
throw new NullPointerException("valueObj is null");
}
}
saveApplicantLoginDetails();
Expand Down