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(); }