Fix crash in Android provisioning client App.
authorSandeep Sharma <sandeep.s9@samsung.com>
Mon, 17 Oct 2016 14:39:11 +0000 (20:09 +0530)
committerRandeep Singh <randeep.s@samsung.com>
Mon, 17 Oct 2016 16:45:49 +0000 (16:45 +0000)
Catch exception in provision Android client for setDeviceId API.

Change-Id: I19918e47eac9f040d490e3805964c6cc7d5d3fba
Signed-off-by: Sandeep Sharma <sandeep.s9@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/13345
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Randeep Singh <randeep.s@samsung.com>
android/android_api/base/src/main/java/org/iotivity/base/OcPlatform.java
android/examples/provisioningclient/src/main/java/org/iotivity/base/examples/provisioningclient/ProvisioningClient.java

index 74fcfb9..6155cea 100644 (file)
@@ -1446,5 +1446,5 @@ public final class OcPlatform {
     /**
      * Method to set DeviceId.
      */
-    public static native void setDeviceId(byte[] deviceId);
+    public static native void setDeviceId(byte[] deviceId) throws OcException;
 }
index b2e857c..820eddf 100644 (file)
@@ -211,9 +211,14 @@ OcSecureResource.DoOwnershipTransferListener, OcSecureResource.ProvisionPairwise
         String devId = new String(deviceIdBytes);
         Log.d(TAG, "Get Device Id "+devId);
         //Set deviceId
-        String setId = "adminDeviceUuid1";
-        OcPlatform.setDeviceId(setId.getBytes());
-        Log.d(TAG, "Set Device Id done");
+        try {
+            String setId = "adminDeviceUuid1";
+            OcPlatform.setDeviceId(setId.getBytes());
+            Log.d(TAG, "Set Device Id done");
+        }
+        catch (OcException e) {
+            Log.d(TAG, e.getMessage());
+        }
 
         try {
             /*