From ec70dad7dace36f86664d43eeed2aada999aa2cb Mon Sep 17 00:00:00 2001 From: Rasika Perera Date: Fri, 23 Oct 2015 12:34:19 +0530 Subject: [PATCH] refactoring --- .../firealarm/service/impl/VirtualFireAlarmService.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/modules/samples/virtual_firealarm/src/org.wso2.carbon.device.mgt.iot.sample.virtual.firealarm.service.impl/src/main/java/org/wso2/carbon/device/mgt/iot/sample/virtual/firealarm/service/impl/VirtualFireAlarmService.java b/modules/samples/virtual_firealarm/src/org.wso2.carbon.device.mgt.iot.sample.virtual.firealarm.service.impl/src/main/java/org/wso2/carbon/device/mgt/iot/sample/virtual/firealarm/service/impl/VirtualFireAlarmService.java index 91626926..f3a07204 100644 --- a/modules/samples/virtual_firealarm/src/org.wso2.carbon.device.mgt.iot.sample.virtual.firealarm.service.impl/src/main/java/org/wso2/carbon/device/mgt/iot/sample/virtual/firealarm/service/impl/VirtualFireAlarmService.java +++ b/modules/samples/virtual_firealarm/src/org.wso2.carbon.device.mgt.iot.sample.virtual.firealarm.service.impl/src/main/java/org/wso2/carbon/device/mgt/iot/sample/virtual/firealarm/service/impl/VirtualFireAlarmService.java @@ -297,7 +297,7 @@ public class VirtualFireAlarmService { } } - return userDevicesforFirealarm.toArray(new Device[]{}); + return userDevicesforFirealarm.toArray(new Device[] {}); } catch (DeviceManagementException e) { response.setStatus(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode()); return null; @@ -641,7 +641,9 @@ public class VirtualFireAlarmService { sensorRecord = SensorDataManager.getInstance().getSensorRecord(deviceId, VirtualFireAlarmConstants.SENSOR_TEMPERATURE); } catch (DeviceManagementException e) { response.setStatus(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode()); - } + } catch (DeviceControllerException e){ + response.setStatus(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode()); + } response.setStatus(Response.Status.OK.getStatusCode()); return sensorRecord;