Fixing operation response ERROR state exception

revert-dabc3590
Kasun Delgolla 9 years ago
parent c9a07df91a
commit ef281e1524

@ -262,18 +262,21 @@ public class AndroidAPIUtils {
deviceIdentifier.setId(deviceId); deviceIdentifier.setId(deviceId);
deviceIdentifier.setType(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID); deviceIdentifier.setType(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID);
if (AndroidConstants.OperationCodes.MONITOR.equals(operation.getCode())) { if (!Operation.Status.ERROR.equals(operation.getStatus()) &&
AndroidConstants.OperationCodes.MONITOR.equals(operation.getCode())) {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.info("Received compliance status from MONITOR operation ID: " + operation.getId()); log.info("Received compliance status from MONITOR operation ID: " + operation.getId());
} }
getPolicyManagerService().checkPolicyCompliance(deviceIdentifier, operation.getPayLoad()); getPolicyManagerService().checkPolicyCompliance(deviceIdentifier, operation.getPayLoad());
} else if (AndroidConstants.OperationCodes.APPLICATION_LIST.equals(operation.getCode())) { } else if (!Operation.Status.ERROR.equals(operation.getStatus()) && AndroidConstants.
OperationCodes.APPLICATION_LIST.equals(operation.getCode())) {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.info("Received applications list from device '" + deviceId + "'"); log.info("Received applications list from device '" + deviceId + "'");
} }
updateApplicationList(operation, deviceIdentifier); updateApplicationList(operation, deviceIdentifier);
} else if (AndroidConstants.OperationCodes.DEVICE_INFO.equals(operation.getCode())) { } else if (!Operation.Status.ERROR.equals(operation.getStatus()) && AndroidConstants.
OperationCodes.DEVICE_INFO.equals(operation.getCode())) {
try { try {
Device device = new Gson().fromJson(operation.getOperationResponse(), Device.class); Device device = new Gson().fromJson(operation.getOperationResponse(), Device.class);
@ -284,7 +287,8 @@ public class AndroidAPIUtils {
} }
} else if (AndroidConstants.OperationCodes.DEVICE_LOCATION.equals(operation.getCode())) { } else if (!Operation.Status.ERROR.equals(operation.getStatus()) &&
AndroidConstants.OperationCodes.DEVICE_LOCATION.equals(operation.getCode())) {
try { try {
DeviceLocation location = new Gson().fromJson(operation.getOperationResponse(), DeviceLocation.class); DeviceLocation location = new Gson().fromJson(operation.getOperationResponse(), DeviceLocation.class);
// reason for checking "location.getLatitude() != null" because when device fails to provide // reason for checking "location.getLatitude() != null" because when device fails to provide

Loading…
Cancel
Save