From 4fb77cbee8d48ebc383f6dde4f12316313f9c354 Mon Sep 17 00:00:00 2001 From: nishadi Date: Wed, 17 Jan 2018 11:45:14 +0530 Subject: [PATCH] Modify CommentsManagerImpl Removed throwing NullPointerException; --- .../application/mgt/core/impl/CommentsManagerImpl.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/CommentsManagerImpl.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/CommentsManagerImpl.java index 5ca47278ca..a310e77a53 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/CommentsManagerImpl.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/CommentsManagerImpl.java @@ -35,6 +35,7 @@ import org.wso2.carbon.device.application.mgt.core.exception.ApplicationManageme import org.wso2.carbon.device.application.mgt.core.exception.NotFoundException; import org.wso2.carbon.device.application.mgt.core.util.ConnectionManagerUtil; +import javax.ws.rs.core.Response; import java.sql.SQLException; import java.sql.Timestamp; import java.time.Instant; @@ -96,9 +97,9 @@ public class CommentsManagerImpl implements CommentsManager { throw new CommentManagementException("Comment ID is null or negative. Comment id is a required parameter to get the " + "relevant comment."); } - if(comment==null){ - throw new NullPointerException("No comment is entered."); + log.error("Null Point Exception.Comment at comment id "+apAppCommentId+" is null."); + return false; } try { @@ -125,7 +126,7 @@ public class CommentsManagerImpl implements CommentsManager { try { ConnectionManagerUtil.openDBConnection(); - comments=commentDAO.getAllComments(uuid,request);//count ,pagination request + comments=commentDAO.getAllComments(uuid,request); int count=commentDAO.getCommentCount(request,uuid); paginationResult.setData(comments); paginationResult.setRecordsFiltered(count);