← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 10786: Fixed minor bug in SmsSender

 

------------------------------------------------------------
revno: 10786
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2013-05-09 19:17:28 +0200
message:
  Fixed minor bug in SmsSender
modified:
  dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/outbound/SmsSender.java


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/outbound/SmsSender.java'
--- dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/outbound/SmsSender.java	2013-04-17 09:03:38 +0000
+++ dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/outbound/SmsSender.java	2013-05-09 17:17:28 +0000
@@ -85,7 +85,7 @@
 
         String gatewayId = transportService.getDefaultGateway();
 
-        if ( gatewayId != null || gatewayId.trim().length() != 0 )
+        if ( gatewayId != null && !gatewayId.trim().isEmpty() )
         {
             boolean sendSMSNotification = false;
             for ( User user : users )
@@ -146,7 +146,7 @@
 
         text = "From " + name + subject + ": " + text;
 
-        // Simplistic cutoff 160 characters..
+        // Simplistic cutoff 160 characters
         int length = text.length();
 
         return (length > 160) ? text.substring( 0, 157 ) + "..." : text;
@@ -183,7 +183,5 @@
         {
             log.warn( "Unable to send message through sms: " + sms, e );
         }
-
     }
-
 }