From 565087f4f2f08b2048b5070f13233de76f2dcc1c Mon Sep 17 00:00:00 2001 From: nishadi Date: Wed, 28 Feb 2018 12:16:20 +0530 Subject: [PATCH] Changed CommentManagementAPIImpl Message of the errors were changed. --- .../impl/CommentManagementAPIImpl.java | 26 +++++++++++-------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.api/src/main/java/org/wso2/carbon/device/application/mgt/store/api/services/impl/CommentManagementAPIImpl.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.api/src/main/java/org/wso2/carbon/device/application/mgt/store/api/services/impl/CommentManagementAPIImpl.java index d378ecda03..8f842d3e1a 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.api/src/main/java/org/wso2/carbon/device/application/mgt/store/api/services/impl/CommentManagementAPIImpl.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.api/src/main/java/org/wso2/carbon/device/application/mgt/store/api/services/impl/CommentManagementAPIImpl.java @@ -70,7 +70,7 @@ public class CommentManagementAPIImpl implements CommentManagementAPI { } catch (CommentManagementException e) { String msg = "Error occurred while retrieving comments."; log.error(msg, e); - return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(" Internal server error occurs") + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg) .build(); } return Response.status(Response.Status.OK).entity(comments).build(); @@ -98,7 +98,7 @@ public class CommentManagementAPIImpl implements CommentManagementAPI { String msg = "Error occurred while creating the comment"; log.error(msg, e); return Response.status(Response.Status.INTERNAL_SERVER_ERROR) - .entity("Internal server error occurs").build(); + .entity(msg).build(); } } @@ -127,7 +127,7 @@ public class CommentManagementAPIImpl implements CommentManagementAPI { String msg = "Error occurred while retrieving comments."; log.error(msg, e); return Response.status(Response.Status.INTERNAL_SERVER_ERROR) - .entity(" Internal server error occurs").build(); + .entity(msg).build(); } } @@ -147,7 +147,7 @@ public class CommentManagementAPIImpl implements CommentManagementAPI { } catch (CommentManagementException e) { String msg = "Error occurred while deleting the comment."; log.error(msg, e); - return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity("Internal server error occurs") + return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg) .build(); } return Response.status(Response.Status.OK).entity("Comment is deleted successfully.").build(); @@ -167,9 +167,10 @@ public class CommentManagementAPIImpl implements CommentManagementAPI { log.error("Comment Management Exception occurs", e); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build(); } catch (ApplicationManagementException e) { - log.error("Application Management Exception occurs", e); + String msg="Application Management Exception occurs"; + log.error(msg, e); return Response.status(Response.Status.INTERNAL_SERVER_ERROR) - .entity("Internal server error occurs").build(); + .entity(msg).build(); } return Response.status(Response.Status.OK).entity(Stars).build(); } @@ -185,11 +186,13 @@ public class CommentManagementAPIImpl implements CommentManagementAPI { try { ratedUsers = commentsManager.getRatedUser(uuid); } catch (CommentManagementException e) { - log.error("Comment Management Exception occurs", e); + String msg="Comment Management Exception occurs"; + log.error(msg, e); return Response.status(Response.Status.INTERNAL_SERVER_ERROR) - .entity("Internal server error occurs").build(); + .entity(msg).build(); } catch (ApplicationManagementException e) { - log.error("Application Management Exception occurs", e); + String msg="Application Management Exception occurs"; + log.error(msg, e); return Response.status(Response.Status.INTERNAL_SERVER_ERROR) .entity("Application with UUID" + uuid + " Internal server error occurs").build(); } @@ -215,9 +218,10 @@ public class CommentManagementAPIImpl implements CommentManagementAPI { return Response.status(Response.Status.BAD_REQUEST).build(); } } catch (ApplicationManagementException e) { - log.error("Application Management Exception occurs", e); + String msg="Application Management Exception occurs"; + log.error(msg, e); return Response.status(Response.Status.INTERNAL_SERVER_ERROR) - .entity(" Internal server error occurs").build(); + .entity(msg).build(); } } } \ No newline at end of file