Skip to content

Commit

Permalink
MOSIP-36579 Added null check
Browse files Browse the repository at this point in the history
Signed-off-by: kameshsr <[email protected]>
  • Loading branch information
kameshsr committed Oct 17, 2024
1 parent 27e245d commit 607aab5
Showing 1 changed file with 6 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,13 @@ public class DataShareManager {
public <R> R downloadObject(String dataShareUrl, Class<R> clazz, boolean decryptionRequired) throws RestServiceException, IdAuthenticationBusinessException {
RestRequestDTO request = restRequestFactory.buildRequest(RestServicesConstants.DATA_SHARE_GET, null, String.class);
request.setUri(dataShareUrl);
String responseStr = null;
if(restTemplate!=null){
responseStr = restTemplate.getForObject(dataShareUrl, String.class);
String responseStr = restTemplate.getForObject(dataShareUrl, String.class);
if (responseStr == null) {
throw new IdAuthUncheckedException(IdAuthenticationErrorConstants.UNABLE_TO_PROCESS.getErrorCode(), IdAuthenticationErrorConstants.UNABLE_TO_PROCESS.getErrorMessage());
}
Optional<Entry<String, Object>> errorOpt = Optional.empty();
if(responseStr!=null){
errorOpt = RestUtil.getError(responseStr, mapper);
}
if (errorOpt.isEmpty() && responseStr!=null) {
Optional<Entry<String, Object>> errorOpt = RestUtil.getError(responseStr, mapper);

if (errorOpt.isEmpty()) {
R result;
if (decryptionRequired) {
// Decrypt data
Expand Down

0 comments on commit 607aab5

Please sign in to comment.