fineract-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From awa...@apache.org
Subject [fineract] branch develop updated: FINERACT-1088: Fixing error message from SMS campaigns
Date Thu, 27 Aug 2020 20:37:19 GMT
This is an automated email from the ASF dual-hosted git repository.

awasum pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/fineract.git


The following commit(s) were added to refs/heads/develop by this push:
     new 9ef10c9  FINERACT-1088: Fixing error message from SMS campaigns
9ef10c9 is described below

commit 9ef10c98382223662bb21e05785992165af19ca6
Author: Petri Tuomola <petri@tuomola.org>
AuthorDate: Wed Aug 26 15:15:27 2020 +0300

    FINERACT-1088: Fixing error message from SMS campaigns
---
 .../SmsCampaignDropdownReadPlatformServiceImpl.java    | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/sms/service/SmsCampaignDropdownReadPlatformServiceImpl.java
b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/sms/service/SmsCampaignDropdownReadPlatformServiceImpl.java
index 4f564e0..61e5df6 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/sms/service/SmsCampaignDropdownReadPlatformServiceImpl.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/sms/service/SmsCampaignDropdownReadPlatformServiceImpl.java
@@ -43,6 +43,7 @@ import org.springframework.http.HttpMethod;
 import org.springframework.http.HttpStatus;
 import org.springframework.http.ResponseEntity;
 import org.springframework.stereotype.Service;
+import org.springframework.web.client.ResourceAccessException;
 import org.springframework.web.client.RestTemplate;
 
 @Service
@@ -72,17 +73,24 @@ public class SmsCampaignDropdownReadPlatformServiceImpl implements SmsCampaignDr
     @Override
     public Collection<SmsProviderData> retrieveSmsProviders() {
         Collection<SmsProviderData> smsProviderOptions = new ArrayList<>();
-        String hostName = "";
         Map<String, Object> hostConfig = this.smsConfigUtils.getMessageGateWayRequestURI("smsbridges",
null);
         URI uri = (URI) hostConfig.get("uri");
-        hostName = uri.getHost();
         HttpEntity<?> entity = (HttpEntity<?>) hostConfig.get("entity");
-        ResponseEntity<Collection<SmsProviderData>> responseOne = restTemplate.exchange(uri,
HttpMethod.GET, entity,
-                new ParameterizedTypeReference<Collection<SmsProviderData>>()
{});
-        if (!responseOne.getStatusCode().equals(HttpStatus.OK)) {
+
+        ResponseEntity<Collection<SmsProviderData>> responseOne = null;
+
+        try {
+            responseOne = restTemplate.exchange(uri, HttpMethod.GET, entity,
+                    new ParameterizedTypeReference<Collection<SmsProviderData>>()
{});
+        } catch (ResourceAccessException ex) {
+            LOG.debug("Mobile service provider {} not available", uri, ex);
+        }
+
+        if (responseOne == null || !responseOne.getStatusCode().equals(HttpStatus.OK)) {
             throw new PlatformDataIntegrityException("error.msg.mobile.service.provider.not.available",
                     "Mobile service provider not available.");
         }
+
         smsProviderOptions = responseOne.getBody();
         return smsProviderOptions;
     }


Mime
View raw message