------------------------------------------------------------
revno: 10174
committer: Magnus Korvald <[email protected]>
branch nick: trunk
timestamp: Wed 2013-03-13 11:37:24 +0100
message:
  Logging of unknown phone numbers
modified:
  
dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/parse/DefaultParserManager.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/parse/DefaultParserManager.java'
--- dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/parse/DefaultParserManager.java	2013-03-13 06:43:01 +0000
+++ dhis-2/dhis-services/dhis-service-sms/src/main/java/org/hisp/dhis/sms/parse/DefaultParserManager.java	2013-03-13 10:37:24 +0000
@@ -107,6 +107,7 @@
         Collection<OrganisationUnit> orgUnits = getOrganisationUnitsByPhoneNumber( sender );
         if ( orgUnits == null || orgUnits.size() == 0 )
         {
+            log.info( "No user found for phone number: " + sender );
             throw new SMSParserException( "No user associated with this phone number. Please contact your supervisor." );
         }
 
@@ -115,8 +116,16 @@
             throw new SMSParserException( "No command in SMS" );
         }
 
-        String commandString = message.substring( 0, message.indexOf( " " ) );
-        message = message.substring( commandString.length() );
+        String commandString = null;
+        if ( message.indexOf( " " ) > 0 )
+        {
+            commandString = message.substring( 0, message.indexOf( " " ) );
+            message = message.substring( commandString.length() );
+        }
+        else
+        {
+            commandString = message;
+        }
 
         boolean foundCommand = false;
 

_______________________________________________
Mailing list: https://launchpad.net/~dhis2-devs
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~dhis2-devs
More help   : https://help.launchpad.net/ListHelp

Reply via email to