From 3908705b68910385cc0af6a0d8bfb4a8756f8c80 Mon Sep 17 00:00:00 2001 From: Dilshan Edirisuriya Date: Tue, 7 Jul 2015 18:18:23 +0530 Subject: [PATCH] Null check --- .../operation/mgt/dao/util/OperationDAOUtil.java | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/util/OperationDAOUtil.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/util/OperationDAOUtil.java index f09f83a303..14cd1d0e5b 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/util/OperationDAOUtil.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/util/OperationDAOUtil.java @@ -81,11 +81,19 @@ public class OperationDAOUtil { } operation.setEnabled(dtoOperation.isEnabled()); operation.setCode(dtoOperation.getCode()); - operation.setType(org.wso2.carbon.device.mgt.common.operation.mgt.Operation.Type.valueOf(dtoOperation - .getType().toString())); + + if(dtoOperation.getType() != null) { + operation.setType(org.wso2.carbon.device.mgt.common.operation.mgt.Operation.Type.valueOf(dtoOperation + .getType().toString())); + } + operation.setCreatedTimeStamp(dtoOperation.getCreatedTimeStamp()); - operation.setStatus(org.wso2.carbon.device.mgt.common.operation.mgt.Operation.Status.valueOf(dtoOperation - .getStatus().toString())); + + if(dtoOperation.getStatus() != null) { + operation.setStatus(org.wso2.carbon.device.mgt.common.operation.mgt.Operation.Status.valueOf(dtoOperation + .getStatus().toString())); + } + operation.setId(dtoOperation.getId()); operation.setPayLoad(dtoOperation.getPayLoad()); operation.setReceivedTimeStamp(dtoOperation.getReceivedTimeStamp());