diff --git a/components/application-mgt/io.entgra.application.mgt.core/src/main/java/io/entgra/application/mgt/core/impl/ApplicationManagerImpl.java b/components/application-mgt/io.entgra.application.mgt.core/src/main/java/io/entgra/application/mgt/core/impl/ApplicationManagerImpl.java index 33ad0f1bde8..c550e9c3164 100644 --- a/components/application-mgt/io.entgra.application.mgt.core/src/main/java/io/entgra/application/mgt/core/impl/ApplicationManagerImpl.java +++ b/components/application-mgt/io.entgra.application.mgt.core/src/main/java/io/entgra/application/mgt/core/impl/ApplicationManagerImpl.java @@ -402,7 +402,7 @@ public class ApplicationManagerImpl implements ApplicationManager { */ private void validateRemoveAppFromFavouritesRequest(int appId) throws ApplicationManagementException { if (!isFavouriteApp(appId)) { - String msg = "Provided appId " + appId + " is not a favourite app in order remove from favourites"; + String msg = "Provided application is not a favourite app in order remove from favourites"; throw new BadRequestException(msg); } } @@ -417,11 +417,11 @@ public class ApplicationManagerImpl implements ApplicationManager { try { getApplication(appId); } catch (NotFoundException e) { - String msg = " No application exists for the provided appId " + appId; + String msg = "Requested application does not exists for add to favourites."; throw new BadRequestException(msg); } if (isFavouriteApp(appId)) { - String msg = "Provided appId " + appId + " is already a favourite app"; + String msg = "Requested application is already in favourites list."; throw new BadRequestException(msg); } } diff --git a/components/application-mgt/io.entgra.application.mgt.core/src/main/java/io/entgra/application/mgt/core/impl/ReviewManagerImpl.java b/components/application-mgt/io.entgra.application.mgt.core/src/main/java/io/entgra/application/mgt/core/impl/ReviewManagerImpl.java index 323149d8941..facbfa4163a 100644 --- a/components/application-mgt/io.entgra.application.mgt.core/src/main/java/io/entgra/application/mgt/core/impl/ReviewManagerImpl.java +++ b/components/application-mgt/io.entgra.application.mgt.core/src/main/java/io/entgra/application/mgt/core/impl/ReviewManagerImpl.java @@ -224,7 +224,7 @@ public class ReviewManagerImpl implements ReviewManager { throw new ReviewManagementException(msg, e); } catch (ApplicationManagementDAOException e) { ConnectionManagerUtil.rollbackDBTransaction(); - String msg = "Error occured while verifying whether application release is exists or not for UUID " + uuid; + String msg = "Error occurred while verifying whether application release is exists or not for UUID " + uuid; log.error(msg, e); throw new ReviewManagementException(msg, e); } finally { @@ -360,7 +360,7 @@ public class ReviewManagerImpl implements ReviewManager { return null; } catch (ReviewManagementDAOException e) { ConnectionManagerUtil.rollbackDBTransaction(); - String msg = "Error occured while getting reviewTmp with reviewTmp id " + reviewId + "."; + String msg = "Error occurred while getting reviewTmp with reviewTmp id " + reviewId + "."; log.error(msg, e); throw new ReviewManagementException(msg, e); } catch (DBConnectionException e) { @@ -393,11 +393,11 @@ public class ReviewManagerImpl implements ReviewManager { } return getReviewTree(this.reviewDAO.getAllReleaseReviews(releaseDTO.getId(), request, tenantId)); } catch (ReviewManagementDAOException e) { - String msg = "Error occured while getting all reviews for application uuid: " + uuid; + String msg = "Error occurred while getting all reviews for application uuid: " + uuid; log.error(msg, e); throw new ReviewManagementException(msg, e); } catch (DBConnectionException e) { - String msg ="Error occured while getting the DB connection to get all reviews for application release which" + String msg ="Error occurred while getting the DB connection to get all reviews for application release which" + " has UUID " + uuid; log.error(msg, e); throw new ReviewManagementException(msg, e); @@ -423,12 +423,12 @@ public class ReviewManagerImpl implements ReviewManager { ConnectionManagerUtil.openDBConnection(); return getReviewTree(this.reviewDAO.getAllActiveAppReviews(applicationReleaseIds, request, tenantId)); } catch (ReviewManagementDAOException e) { - String msg = "Error occured while getting all reviews for application which has an " + String msg = "Error occurred while getting all reviews for application which has an " + "application release of uuid: " + uuid; log.error(msg, e); throw new ReviewManagementException(msg, e); } catch (DBConnectionException e) { - String msg = "Error occured while getting the DB connection to get app app reviews."; + String msg = "Error occurred while getting the DB connection to get app app reviews."; log.error(msg, e); throw new ReviewManagementException(msg, e); } finally { @@ -458,12 +458,12 @@ public class ReviewManagerImpl implements ReviewManager { } return getReviewTree(reviewDtos); } catch (ReviewManagementDAOException e) { - String msg = "Error occured while getting all " + username + "'s reviews for application which has an " + String msg = "Error occurred while getting all " + username + "'s reviews for application which has an " + "application release of uuid: " + uuid; log.error(msg, e); throw new ReviewManagementException(msg, e); } catch (DBConnectionException e) { - String msg = "Error occured while getting DB connection to get all " + username + "'s reviews for " + String msg = "Error occurred while getting DB connection to get all " + username + "'s reviews for " + "application which has an application release of uuid: " + uuid; log.error(msg, e); throw new ReviewManagementException(msg, e); @@ -486,7 +486,7 @@ public class ReviewManagerImpl implements ReviewManager { .collect(Collectors.toList()); } catch (DBConnectionException e) { String msg = - "Error occured while getting the DB connection to get application which has application release" + "Error occurred while getting the DB connection to get application which has application release" + " of UUID: " + uuid; log.error(msg, e); throw new ReviewManagementException(msg, e); @@ -526,7 +526,7 @@ public class ReviewManagerImpl implements ReviewManager { paginationResult.setRecordsTotal(numOfReviews); return paginationResult; } catch (ReviewManagementDAOException e) { - String msg = "Error occured while getting all reply comments for given review list"; + String msg = "Error occurred while getting all reply comments for given review list"; log.error(msg, e); throw new ReviewManagementException(msg, e); } @@ -635,11 +635,11 @@ public class ReviewManagerImpl implements ReviewManager { throw new ReviewManagementException(msg, e); } catch (ReviewManagementDAOException e) { ConnectionManagerUtil.rollbackDBTransaction(); - String msg = "Error occured while deleting review with review id " + reviewId + "."; + String msg = "Error occurred while deleting review with review id " + reviewId + "."; log.error(msg, e); throw new ReviewManagementException(msg, e); } catch (TransactionManagementException e) { - String msg = "Error occurred when handleing transaction to delete application reviews."; + String msg = "Error occurred when handling transaction to delete application reviews."; log.error(msg, e); throw new ReviewManagementException(msg, e); } finally { @@ -663,16 +663,16 @@ public class ReviewManagerImpl implements ReviewManager { return rating; } catch (ApplicationManagementDAOException e) { String msg = - "Error occured while getting the rating value of the application release uuid: " + appReleaseUuid; + "Error occurred while getting the rating value of the application release uuid: " + appReleaseUuid; log.error(msg, e); throw new ReviewManagementException(msg, e); } catch (DBConnectionException e) { - String msg = "DB Connection error occured while getting the rating value of the application release uuid: " + String msg = "DB Connection error occurred while getting the rating value of the application release uuid: " + appReleaseUuid; log.error(msg, e); throw new ReviewManagementException(msg, e); } catch (ReviewManagementDAOException e) { - String msg = "Error occured while getting all rating values for the application release UUID: " + String msg = "Error occurred while getting all rating values for the application release UUID: " + appReleaseUuid; log.error(msg, e); throw new ReviewManagementException(msg, e); @@ -704,18 +704,18 @@ public class ReviewManagerImpl implements ReviewManager { return rating; } catch (DBConnectionException e) { String msg = - "DB Connection error occured while getting app rating of the application which has application " + "DB Connection error occurred while getting app rating of the application which has application " + "release for uuid: " + appReleaseUuid; log.error(msg, e); throw new ReviewManagementException(msg, e); } catch (ApplicationManagementDAOException e) { - String msg = "Error occured while getting the application DTO for the application release uuid: " + String msg = "Error occurred while getting the application DTO for the application release uuid: " + appReleaseUuid; log.error(msg, e); throw new ReviewManagementException(msg, e); } catch (ReviewManagementDAOException e) { String msg = - "Error occured while getting all rating values of application which has the application release " + "Error occurred while getting all rating values of application which has the application release " + "for UUID: " + appReleaseUuid; log.error(msg, e); throw new ReviewManagementException(msg, e); diff --git a/components/application-mgt/io.entgra.application.mgt.core/src/main/java/io/entgra/application/mgt/core/impl/SubscriptionManagerImpl.java b/components/application-mgt/io.entgra.application.mgt.core/src/main/java/io/entgra/application/mgt/core/impl/SubscriptionManagerImpl.java index 74d423a8732..a2cb17b079b 100644 --- a/components/application-mgt/io.entgra.application.mgt.core/src/main/java/io/entgra/application/mgt/core/impl/SubscriptionManagerImpl.java +++ b/components/application-mgt/io.entgra.application.mgt.core/src/main/java/io/entgra/application/mgt/core/impl/SubscriptionManagerImpl.java @@ -367,14 +367,14 @@ public class SubscriptionManagerImpl implements SubscriptionManager { try { device = DataHolder.getInstance().getDeviceManagementService().getDevice(deviceIdentifier, false); if (device == null) { - String msg = "Invalid device identifier is received and couldn't find an deveice for the requested " + String msg = "Invalid device identifier is received and couldn't find an device for the requested " + "device identifier. Device UUID: " + deviceIdentifier.getId() + " Device Type: " + deviceIdentifier.getType(); log.error(msg); throw new BadRequestException(msg); } } catch (DeviceManagementException e) { - String msg = "Error occured while getting device data for given device identifier.Device UUID: " + String msg = "Error occurred while getting device data for given device identifier.Device UUID: " + deviceIdentifier.getId() + " Device Type: " + deviceIdentifier.getType(); log.error(msg, e); throw new ApplicationManagementException(msg, e); diff --git a/components/application-mgt/io.entgra.application.mgt.store.api/src/main/java/io/entgra/application/mgt/store/api/services/impl/ApplicationManagementAPIImpl.java b/components/application-mgt/io.entgra.application.mgt.store.api/src/main/java/io/entgra/application/mgt/store/api/services/impl/ApplicationManagementAPIImpl.java index 5f1f124d636..f771645a771 100644 --- a/components/application-mgt/io.entgra.application.mgt.store.api/src/main/java/io/entgra/application/mgt/store/api/services/impl/ApplicationManagementAPIImpl.java +++ b/components/application-mgt/io.entgra.application.mgt.store.api/src/main/java/io/entgra/application/mgt/store/api/services/impl/ApplicationManagementAPIImpl.java @@ -58,7 +58,7 @@ public class ApplicationManagementAPIImpl implements ApplicationManagementAPI { applicationManager.addAppToFavourites(appId); return Response.status(Response.Status.OK).build(); } catch (BadRequestException e) { - String msg = "Invalid payload found in the request. Hence verify the request payload."; + String msg = e.getMessage(); log.error(msg, e); return Response.status(Response.Status.BAD_REQUEST).entity(msg).build(); } catch (ApplicationManagementException e) { @@ -78,7 +78,7 @@ public class ApplicationManagementAPIImpl implements ApplicationManagementAPI { applicationManager.removeAppFromFavourites(appId); return Response.status(Response.Status.OK).build(); } catch (BadRequestException e) { - String msg = "Invalid payload found in the request. Hence verify the request payload."; + String msg = e.getMessage(); log.error(msg, e); return Response.status(Response.Status.BAD_REQUEST).entity(msg).build(); } catch (ApplicationManagementException e) { @@ -147,7 +147,7 @@ public class ApplicationManagementAPIImpl implements ApplicationManagementAPI { String msg = "Could not found an application release which is in " + applicationManager .getInstallableLifecycleState() + " state."; log.error(msg); - return Response.status(Response.Status.OK).entity(msg).build(); + return Response.status(Response.Status.NOT_FOUND).entity(msg).build(); } return Response.status(Response.Status.OK).entity(application).build(); } catch (NotFoundException e) { diff --git a/components/application-mgt/io.entgra.application.mgt.store.api/src/main/java/io/entgra/application/mgt/store/api/services/impl/ReviewManagementAPIImpl.java b/components/application-mgt/io.entgra.application.mgt.store.api/src/main/java/io/entgra/application/mgt/store/api/services/impl/ReviewManagementAPIImpl.java index 8aa8b728af9..b07f1ea9c61 100644 --- a/components/application-mgt/io.entgra.application.mgt.store.api/src/main/java/io/entgra/application/mgt/store/api/services/impl/ReviewManagementAPIImpl.java +++ b/components/application-mgt/io.entgra.application.mgt.store.api/src/main/java/io/entgra/application/mgt/store/api/services/impl/ReviewManagementAPIImpl.java @@ -131,7 +131,7 @@ public class ReviewManagementAPIImpl implements ReviewManagementAPI { log.error(msg, e); return Response.status(Response.Status.NOT_FOUND).entity(msg).build(); } catch (BadRequestException e) { - String msg = "Found invalid payload data with the request. Hence, please verify the request payload."; + String msg = e.getMessage(); log.error(msg); return Response.status(Response.Status.BAD_REQUEST).entity(msg).build(); } catch (ForbiddenException e) { @@ -144,7 +144,7 @@ public class ReviewManagementAPIImpl implements ReviewManagementAPI { log.error(msg, e); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build(); } catch (ApplicationManagementException e) { - String msg = "Error occured while accessing application release for UUID: " + uuid; + String msg = "Error occurred while accessing application release for UUID: " + uuid; log.error(msg, e); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build(); } @@ -164,7 +164,7 @@ public class ReviewManagementAPIImpl implements ReviewManagementAPI { if (isRepliedForReview) { return Response.status(Response.Status.CREATED).entity(reviewWrapper).build(); } else { - String msg = "Error occured when adding reply comment for the review. Please contact the administrator.."; + String msg = "Error occurred when adding reply comment for the review. Please contact the administrator.."; log.error(msg); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build(); } @@ -173,7 +173,7 @@ public class ReviewManagementAPIImpl implements ReviewManagementAPI { log.error(msg, e); return Response.status(Response.Status.NOT_FOUND).entity(msg).build(); } catch (BadRequestException e) { - String msg = "Found invalid payload data with the request to add reply comment. Hence, please verify the " + String msg = "Invalid payload data found with the requested add reply comment. Hence, please verify the " + "request payload."; log.error(msg); return Response.status(Response.Status.BAD_REQUEST).entity(msg).build(); @@ -182,7 +182,7 @@ public class ReviewManagementAPIImpl implements ReviewManagementAPI { log.error(msg, e); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build(); } catch (ApplicationManagementException e) { - String msg = "Error occured while accessing application release for UUID: " + uuid; + String msg = "Error occurred while accessing application release for UUID: " + uuid; log.error(msg, e); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build(); } @@ -214,8 +214,12 @@ public class ReviewManagementAPIImpl implements ReviewManagementAPI { String msg = "Couldn't found application release data for UUID " + uuid + " or Review for review ID: " + reviewId; log.error(msg, e); return Response.status(Response.Status.NOT_FOUND).entity(msg).build(); + } catch (BadRequestException e) { + String msg = "Invalid payload data found with the request. Hence, please verify the request payload."; + log.error(msg); + return Response.status(Response.Status.BAD_REQUEST).entity(msg).build(); } catch (ForbiddenException e) { - String msg = "You dont have permission to update application release review."; + String msg = "You don't have permission to update application release review."; log.error(msg, e); return Response.status(Response.Status.FORBIDDEN).entity(msg).build(); } catch (ApplicationManagementException e) { @@ -267,7 +271,7 @@ public class ReviewManagementAPIImpl implements ReviewManagementAPI { log.error(msg, e); return Response.status(Response.Status.NOT_FOUND).entity(msg).build(); } catch (ReviewManagementException | ApplicationManagementException e) { - String msg = "Error occured while getting review data for application release UUID: " + uuid; + String msg = "Error occurred while getting review data for application release UUID: " + uuid; log.error(msg, e); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build(); } diff --git a/components/application-mgt/io.entgra.application.mgt.store.api/src/main/java/io/entgra/application/mgt/store/api/services/impl/SubscriptionManagementAPIImpl.java b/components/application-mgt/io.entgra.application.mgt.store.api/src/main/java/io/entgra/application/mgt/store/api/services/impl/SubscriptionManagementAPIImpl.java index 11b1ffa6893..ab13168e174 100644 --- a/components/application-mgt/io.entgra.application.mgt.store.api/src/main/java/io/entgra/application/mgt/store/api/services/impl/SubscriptionManagementAPIImpl.java +++ b/components/application-mgt/io.entgra.application.mgt.store.api/src/main/java/io/entgra/application/mgt/store/api/services/impl/SubscriptionManagementAPIImpl.java @@ -93,12 +93,11 @@ public class SubscriptionManagementAPIImpl implements SubscriptionManagementAPI{ SubAction.valueOf(action.toUpperCase()), timestamp, properties); } } catch (NotFoundException e) { - String msg = "Couldn't found an application release for UUI: " + uuid; + String msg = "Couldn't found an application release for UUID: " + uuid; log.error(msg, e); return Response.status(Response.Status.NOT_FOUND).entity(msg).build(); } catch (BadRequestException e) { - String msg = "Found invalid payload for installing application which has UUID: " + uuid + ". Hence verify " - + "the payload"; + String msg = e.getMessage(); log.error(msg, e); return Response.status(Response.Status.BAD_REQUEST).entity(msg).build(); } catch (ForbiddenException e) { @@ -147,8 +146,7 @@ public class SubscriptionManagementAPIImpl implements SubscriptionManagementAPI{ log.error(msg, e); return Response.status(Response.Status.NOT_FOUND).entity(msg).build(); } catch (BadRequestException e) { - String msg = "Found invalid payload for installing application which has UUID: " + uuid + ". Hence verify " - + "the payload"; + String msg = e.getMessage(); log.error(msg, e); return Response.status(Response.Status.BAD_REQUEST).entity(msg).build(); } catch (ForbiddenException e) { @@ -187,13 +185,12 @@ public class SubscriptionManagementAPIImpl implements SubscriptionManagementAPI{ SubAction.valueOf(SubAction.INSTALL.toString().toUpperCase()), timestamp, null); } } catch (NotFoundException e) { - String msg = "Couldn't found an application release for UUI: " + uuid + " to perform ent app installation " + String msg = "Couldn't found an application release for UUID: " + uuid + " to perform ent app installation " + "on subscriber's devices"; log.error(msg, e); return Response.status(Response.Status.NOT_FOUND).entity(msg).build(); } catch (BadRequestException e) { - String msg = "Found invalid payload when performing ent app installation on application which has UUID: " - + uuid + ". Hence verify the payload of the request."; + String msg = e.getMessage(); log.error(msg, e); return Response.status(Response.Status.BAD_REQUEST).entity(msg).build(); } catch (ForbiddenException e) { @@ -237,8 +234,7 @@ public class SubscriptionManagementAPIImpl implements SubscriptionManagementAPI{ log.error(msg, e); return Response.status(Response.Status.NOT_FOUND).entity(msg).build(); } catch (BadRequestException e) { - String msg = "Found invalid payload when performing ent app installation on application which has UUID: " - + uuid + ". Hence verify the payload of the request."; + String msg = e.getMessage(); log.error(msg, e); return Response.status(Response.Status.BAD_REQUEST).entity(msg).build(); } catch (ForbiddenException e) { @@ -360,7 +356,7 @@ public class SubscriptionManagementAPIImpl implements SubscriptionManagementAPI{ log.error(msg, e); return Response.status(Response.Status.NOT_FOUND).entity(msg).build(); } catch (BadRequestException e) { - String msg = "User requested details are not valid"; + String msg = "User requested details are not valid. Please verify the payload of the request."; log.error(msg, e); return Response.status(Response.Status.BAD_REQUEST).entity(msg).build(); } catch (ForbiddenException e) { @@ -424,8 +420,7 @@ public class SubscriptionManagementAPIImpl implements SubscriptionManagementAPI{ log.error(msg, e); return Response.status(Response.Status.NOT_FOUND).entity(msg).build(); } catch (BadRequestException e) { - String msg = "Found invalid payload for getting application which has UUID: " + uuid - + ". Hence verify the payload"; + String msg = "Invalid payload found when getting application. Hence verify the payload"; log.error(msg, e); return Response.status(Response.Status.BAD_REQUEST).entity(msg).build(); } catch (ForbiddenException e) { @@ -502,6 +497,10 @@ public class SubscriptionManagementAPIImpl implements SubscriptionManagementAPI{ String msg = "Application with application release UUID: " + uuid + " is not found"; log.error(msg, e); return Response.status(Response.Status.NOT_FOUND).entity(msg).build(); + } catch (BadRequestException e) { + String msg = "Invalid payload found with the request. Please verify the payload."; + log.error(msg,e); + return Response.status(Response.Status.BAD_REQUEST).entity(msg).build(); } catch (ApplicationManagementException e) { String msg = "Error occurred while getting application with the application " + "release uuid: " + uuid; diff --git a/components/application-mgt/io.entgra.application.mgt.store.api/src/main/java/io/entgra/application/mgt/store/api/services/impl/admin/SubscriptionManagementAdminAPIImpl.java b/components/application-mgt/io.entgra.application.mgt.store.api/src/main/java/io/entgra/application/mgt/store/api/services/impl/admin/SubscriptionManagementAdminAPIImpl.java index 158696d65e0..08226c72bf0 100644 --- a/components/application-mgt/io.entgra.application.mgt.store.api/src/main/java/io/entgra/application/mgt/store/api/services/impl/admin/SubscriptionManagementAdminAPIImpl.java +++ b/components/application-mgt/io.entgra.application.mgt.store.api/src/main/java/io/entgra/application/mgt/store/api/services/impl/admin/SubscriptionManagementAdminAPIImpl.java @@ -133,7 +133,7 @@ public class SubscriptionManagementAdminAPIImpl implements SubscriptionManagemen log.error(msg, e); return Response.status(Response.Status.NOT_FOUND).entity(msg).build(); } catch (BadRequestException e) { - String msg = "User requested details are not valid"; + String msg = "User requested details are not valid. Please verify the request payload."; log.error(msg, e); return Response.status(Response.Status.BAD_REQUEST).entity(msg).build(); } catch (ApplicationManagementException e) {