[Resource Encapsulation] Android unittest crash fix.
authorarya.k <arya.kumar@samsung.com>
Wed, 2 Sep 2015 09:25:01 +0000 (14:55 +0530)
committerMadan Lanka <lanka.madan@samsung.com>
Thu, 3 Sep 2015 06:42:54 +0000 (06:42 +0000)
Change-Id: I3a71aa30e7521c96a32bf5eb2de76a7189320525
Signed-off-by: arya.k <arya.kumar@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/2349
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Jay Sharma <jay.sharma@samsung.com>
Reviewed-by: Madan Lanka <lanka.madan@samsung.com>
service/resource-encapsulation/sdk/java/src/org/iotivity/ResourceEncapsulation/client/RCSDiscoveryManager.java

index cc87fc9..2899183 100644 (file)
@@ -173,7 +173,18 @@ public class RCSDiscoveryManager {
             String resourceType) throws RCSException {
 
         Log.i(LOG_TAG, "discoverResource called");
+
+        if(null == address){
+            Log.e(LOG_TAG, "Empty Address");
+            throw (new RCSException("Empty Address"));
+        }
         String addr = address.getAddress();
+
+        if(null == relativeURI || "" == relativeURI){
+            Log.e(LOG_TAG, "Empty URI");
+            throw (new RCSException("Empty URI"));
+        }
+
         DiscoveryType typeOfDiscovery = address.getTypeOfDiscovery();
         this.discoverResource(addr, typeOfDiscovery.ordinal(), relativeURI,
                 resourceType, m_discoverListener);