From 30eb8ca91d7c1cd1c7a95cb51462eebcf51a8248 Mon Sep 17 00:00:00 2001 From: Hasunie Date: Fri, 2 Jun 2017 12:44:48 +0530 Subject: [PATCH] adding debug logs to GlobalThrowableMapper --- .../android/exception/GlobalThrowableMapper.java | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/exception/GlobalThrowableMapper.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/exception/GlobalThrowableMapper.java index 6a7d45afb..31370bd88 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/exception/GlobalThrowableMapper.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/exception/GlobalThrowableMapper.java @@ -51,24 +51,27 @@ public class GlobalThrowableMapper implements ExceptionMapper { if (e instanceof JsonParseException) { String errorMessage = "Malformed request body."; if (log.isDebugEnabled()) { - log.error(errorMessage, e); + log.debug(errorMessage, e); } return AndroidDeviceUtils.buildBadRequestException(errorMessage).getResponse(); } if (e instanceof NotFoundException) { - return ((NotFoundException) e).getResponse(); + return ((NotFoundException) e).getResponse(); } if (e instanceof BadRequestException) { return ((BadRequestException) e).getResponse(); } if (e instanceof UnexpectedServerErrorException) { if (log.isDebugEnabled()) { - log.error("Unexpected server error", e); + log.debug("Unexpected server error", e); } return ((UnexpectedServerErrorException) e).getResponse(); } if (e instanceof ConstraintViolationException) { - return ((ParameterValidationException) e).getResponse(); + if (log.isDebugEnabled()) { + log.debug("Constraint violation issue.", e); + return ((ParameterValidationException) e).getResponse(); + } } if (e instanceof IllegalArgumentException) { ErrorDTO errorDetail = new ErrorDTO(); @@ -83,7 +86,7 @@ public class GlobalThrowableMapper implements ExceptionMapper { } if (e instanceof ClientErrorException) { if (log.isDebugEnabled()) { - log.error("Client error", e); + log.debug("Client error", e); } return ((ClientErrorException) e).getResponse(); } @@ -100,7 +103,7 @@ public class GlobalThrowableMapper implements ExceptionMapper { } if (e instanceof ForbiddenException) { if (log.isDebugEnabled()) { - log.error("Resource forbidden", e); + log.debug("Resource forbidden", e); } return ((ForbiddenException) e).getResponse(); }