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 85e46a8491f..31db9eaf6f0 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 @@ -3434,6 +3434,7 @@ public class ApplicationManagerImpl implements ApplicationManager { String userName = PrivilegedCarbonContext.getThreadLocalCarbonContext().getUsername(); int deviceTypeId = -1; String appName; + int appNameLength = 20; List appCategories; List unrestrictedRoles; @@ -3445,7 +3446,7 @@ public class ApplicationManagerImpl implements ApplicationManager { log.error(msg); throw new BadRequestException(msg); } - if (appName.length() > 20) { + if (appName.length() > appNameLength) { String msg = "Application name must be less than or equal to 20 characters in length."; log.error(msg); throw new BadRequestException(msg); @@ -3482,6 +3483,11 @@ public class ApplicationManagerImpl implements ApplicationManager { log.error(msg); throw new BadRequestException(msg); } + if (appName.length() > appNameLength) { + String msg = "Application name must be less than or equal to 20 characters in length."; + log.error(msg); + throw new BadRequestException(msg); + } appCategories = webAppWrapper.getCategories(); if (appCategories == null) { String msg = "Web Clip category can't be null."; @@ -3515,6 +3521,11 @@ public class ApplicationManagerImpl implements ApplicationManager { log.error(msg); throw new BadRequestException(msg); } + if (appName.length() > appNameLength) { + String msg = "Application name must be less than or equal to 20 characters in length."; + log.error(msg); + throw new BadRequestException(msg); + } appCategories = publicAppWrapper.getCategories(); if (appCategories == null) { String msg = "Application category can't be null."; @@ -3547,6 +3558,11 @@ public class ApplicationManagerImpl implements ApplicationManager { log.error(msg); throw new BadRequestException(msg); } + if (appName.length() > appNameLength) { + String msg = "Application name must be less than or equal to 20 characters in length."; + log.error(msg); + throw new BadRequestException(msg); + } appCategories = customAppWrapper.getCategories(); if (appCategories == null) { String msg = "Application category can't be null.";