Error message has been moved in a constant

This commit is contained in:
Luca Frosini 2019-09-09 14:25:27 +02:00
parent 8d7e88ff72
commit 635825ebd9
1 changed files with 5 additions and 2 deletions

View File

@ -37,6 +37,9 @@ public class Profile extends BaseREST implements org.gcube.gcat.api.interfaces.P
public static final String PROFILE_NAME_PARAMETER = "PROFILE_NAME";
public static final String PROFILE_VALIDATION_ERROR;
public static final String CANNOT_MANAGE_PROFILE_SCHEMA = "You cannot manage the profile schema";
static {
StringBuilder validationError = new StringBuilder();
validationError.append("The Profile is not valid because of the following error at validation time:\n%s\n\n");
@ -101,7 +104,7 @@ public class Profile extends BaseREST implements org.gcube.gcat.api.interfaces.P
setCalledMethod("PUT /" + PROFILES + "/{" + PROFILE_NAME_PARAMETER + "}");
try {
if(name.compareToIgnoreCase(SCHEMA) == 0) {
throw new NotAllowedException("You cannot manage the profile schema", new Throwable("You cannot manage the profile schema"),
throw new NotAllowedException(CANNOT_MANAGE_PROFILE_SCHEMA, new Throwable(CANNOT_MANAGE_PROFILE_SCHEMA),
HttpMethod.GET.toString(), HttpMethod.HEAD.toString());
}
ISProfile isProfile = new ISProfile();
@ -131,7 +134,7 @@ public class Profile extends BaseREST implements org.gcube.gcat.api.interfaces.P
setCalledMethod("DELETE /" + PROFILES + "/{" + PROFILE_NAME_PARAMETER + "}");
try {
if(name.compareToIgnoreCase(SCHEMA) == 0) {
throw new NotAllowedException("You cannot manage the profile schema", new Throwable("You cannot manage the profile schema"),
throw new NotAllowedException(CANNOT_MANAGE_PROFILE_SCHEMA, new Throwable(CANNOT_MANAGE_PROFILE_SCHEMA),
HttpMethod.GET.toString(), HttpMethod.HEAD.toString());
}
ISProfile isProfile = new ISProfile();