X-Git-Url: http://lists.indexdata.dk/cgi-bin?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fcom%2Findexdata%2Fpz2utils4jsf%2Ferrors%2FErrorHelper.java;h=4f05b777458fe53c02059501e6380c437980d591;hb=c6b02eac06fa279177b30839c38e8e99f5dc445f;hp=0abad05c3311950b8c3c18de2eb9450f647ef323;hpb=c3af1f841ac7d7cd350b5b9f18088e3081ef9a85;p=mkjsf-moved-to-github.git diff --git a/src/main/java/com/indexdata/pz2utils4jsf/errors/ErrorHelper.java b/src/main/java/com/indexdata/pz2utils4jsf/errors/ErrorHelper.java index 0abad05..4f05b77 100644 --- a/src/main/java/com/indexdata/pz2utils4jsf/errors/ErrorHelper.java +++ b/src/main/java/com/indexdata/pz2utils4jsf/errors/ErrorHelper.java @@ -10,7 +10,6 @@ import java.util.regex.Pattern; import org.apache.log4j.Logger; import com.indexdata.pz2utils4jsf.config.Pz2Configurator; -import com.indexdata.pz2utils4jsf.config.Pz2ConfigureByMk2Config; import com.indexdata.pz2utils4jsf.pazpar2.data.Pazpar2Error; import com.indexdata.pz2utils4jsf.utils.Utils; @@ -24,6 +23,7 @@ public class ErrorHelper implements Serializable { REMOTE_SERVICE_DEF_NOT_FOUND, LOCAL_SETTINGS_FILE_NOT_FOUND, MASTERKEY_CONFIG_FILE_NOT_FOUND, + MISSING_MANDATORY_PARAMETER, NOT_RESOLVED, SKIP_SUGGESTIONS}; @@ -38,7 +38,7 @@ public class ErrorHelper implements Serializable { this.configurator = configurator; } - public ErrorHelper.ErrorCode getErrorCode(ApplicationError appError) { + public ErrorHelper.ErrorCode getErrorCode(ErrorInterface appError) { if (appError.hasPazpar2Error()) { Pazpar2Error pz2err = appError.getPazpar2Error(); String pz2errcode = pz2err.getCode(); @@ -70,11 +70,13 @@ public class ErrorHelper implements Serializable { return ErrorCode.LOCAL_SERVICE_DEF_FILE_NOT_FOUND; } else if (appError.getMessage().contains("Cannot query Pazpar2 while there are configuration errors")) { return ErrorCode.SKIP_SUGGESTIONS; + } else if (appError.getMessage().contains("Missing mandatory parameter")) { + return ErrorCode.MISSING_MANDATORY_PARAMETER; } return ErrorCode.NOT_RESOLVED; } - public ArrayList getSuggestions(ApplicationError error) { + public ArrayList getSuggestions(ErrorInterface error) { ArrayList suggestions = new ArrayList(); ErrorCode code = getErrorCode(error); switch (code) { @@ -106,6 +108,11 @@ public class ErrorHelper implements Serializable { " the file itself could not be found. Please check the configuration."); addConfigurationDocumentation(suggestions); break; + case MISSING_MANDATORY_PARAMETER: + suggestions.add("A mandatory configuration parameter was not found in the MK2 config properties" + + " file used. Please check the property file for the parameter given in the error message "); + addConfigurationDocumentation(suggestions); + break; case NOT_RESOLVED: suggestions.add("Unforeseen error situation. No suggestions prepared."); break;