Fix observe/observe cancel request handling in cloud interface 99/19699/2
authorMinji Park <minjii.park@samsung.com>
Mon, 8 May 2017 06:48:24 +0000 (15:48 +0900)
committerJee Hyeok Kim <jihyeok13.kim@samsung.com>
Wed, 10 May 2017 07:03:01 +0000 (07:03 +0000)
Change-Id: Ib6b6c014b891aa09bd4927c84d7236b0e271adf1
Signed-off-by: Minji Park <minjii.park@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/19699
Tested-by: jenkins-iotivity <jenkins@iotivity.org>
Reviewed-by: jung seungho <shonest.jung@samsung.com>
Reviewed-by: Jee Hyeok Kim <jihyeok13.kim@samsung.com>
cloud/interface/src/main/java/org/iotivity/cloud/ciserver/DeviceServerSystem.java

index 976e904..d55cded 100644 (file)
@@ -181,23 +181,23 @@ public class DeviceServerSystem extends ServerSystem {
                                             .get(RouteResourcePathSize - 1));
                             targetChannel = targetDevice.getRequestChannel();
                         }
-                    }
-                    switch (coapRequest.getObserve()) {
-                        case SUBSCRIBE:
-                            coapDevice.addObserveRequest(
-                                    Bytes.bytesToLong(coapRequest.getToken()),
-                                    coapRequest);
-                            coapDevice.addObserveChannel(targetChannel);
-                            break;
-                        case UNSUBSCRIBE:
-                            coapDevice.removeObserveChannel(targetChannel);
-                            coapDevice.removeObserveRequest(
-                                    Bytes.bytesToLong(coapRequest.getToken()));
-                            break;
-                        default:
-                            break;
-                    }
 
+                        switch (coapRequest.getObserve()) {
+                            case SUBSCRIBE:
+                                coapDevice.addObserveRequest(
+                                        Bytes.bytesToLong(coapRequest.getToken()),
+                                        coapRequest);
+                                coapDevice.addObserveChannel(targetChannel);
+                                break;
+                            case UNSUBSCRIBE:
+                                coapDevice.removeObserveChannel(targetChannel);
+                                coapDevice.removeObserveRequest(
+                                        Bytes.bytesToLong(coapRequest.getToken()));
+                                break;
+                            default:
+                                break;
+                        }
+                    }
                 } catch (Throwable t) {
                     Log.f(ctx.channel(), t);
                     ResponseStatus responseStatus = t instanceof ServerException