Add app name length validation for all types of applications in ApplicationManagerImpl file

pull/27/head
Ravindu Lakshan 2 years ago
parent 67660b478b
commit fcba484ee4

@ -3434,6 +3434,7 @@ public class ApplicationManagerImpl implements ApplicationManager {
String userName = PrivilegedCarbonContext.getThreadLocalCarbonContext().getUsername();
int deviceTypeId = -1;
String appName;
int appNameLength = 20;
List<String> appCategories;
List<String> 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.";

Loading…
Cancel
Save