aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSubodh Ranadive <subodh.ranadive@ekzero.com>2021-03-19 12:20:15 +0530
committerSubodh Ranadive <subodh.ranadive@ekzero.com>2021-03-24 15:30:32 +0530
commitfb37051a51c9ceb643ac4e5374fafaaad2196d95 (patch)
treed0533a9b7a74748d391c13c95c38a7b560762329
parenta7c8ab0d0408518805dc3937b954ecc628b1e845 (diff)
downloadtrackermap-server-fb37051a51c9ceb643ac4e5374fafaaad2196d95.tar.gz
trackermap-server-fb37051a51c9ceb643ac4e5374fafaaad2196d95.tar.bz2
trackermap-server-fb37051a51c9ceb643ac4e5374fafaaad2196d95.zip
Review resolution
-rw-r--r--src/main/java/org/traccar/sms/SnsSmsClient.java11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/main/java/org/traccar/sms/SnsSmsClient.java b/src/main/java/org/traccar/sms/SnsSmsClient.java
index d13fb3c34..8a3710ec8 100644
--- a/src/main/java/org/traccar/sms/SnsSmsClient.java
+++ b/src/main/java/org/traccar/sms/SnsSmsClient.java
@@ -1,5 +1,6 @@
/*
* Copyright 2021 Anton Tananaev (anton@traccar.org)
+ * Copyright 2021 Subodh Ranadive (subodhranadive3103@gmail.com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -40,9 +41,7 @@ public class SnsSmsClient implements SmsManager {
&& Context.getConfig().hasKey(Keys.SMS_AWS_ACCESS)
&& Context.getConfig().hasKey(Keys.SMS_AWS_SECRET)) {
snsClient = awsSNSClient();
- } else {
- throw new RuntimeException("SNS Not Configured Properly. Please provide valid config.");
- }
+ } else { throw new RuntimeException("SNS Not Configured Properly. Please provide valid config."); }
}
public AmazonSNSAsync awsSNSClient() {
@@ -59,8 +58,10 @@ public class SnsSmsClient implements SmsManager {
new MessageAttributeValue().withStringValue("SNS").withDataType("String"));
smsAttributes.put("AWS.SNS.SMS.SMSType",
new MessageAttributeValue().withStringValue("Transactional").withDataType("String"));
- snsClient.publishAsync(new PublishRequest().withMessage(message)
- .withPhoneNumber(destAddress).withMessageAttributes(smsAttributes));
+ try {
+ snsClient.publishAsync(new PublishRequest().withMessage(message)
+ .withPhoneNumber(destAddress).withMessageAttributes(smsAttributes));
+ } catch (Exception exception) { LOGGER.warn("SMS send failed", exception); }
}
@Override