X-Git-Url: http://jsfdemo.indexdata.com/?a=blobdiff_plain;ds=sidebyside;f=src%2Fmain%2Fjava%2Fcom%2Findexdata%2Fpz2utils4jsf%2Ferrors%2FErrorHelper.java;h=0664f20e2a4124c267fc9386418155de04a54728;hb=332204f1699f9b7d5714d7e5c49dbe8edaf94d32;hp=e78fb4db39ed5b50214371d0f69939a79aaa48c2;hpb=0f4faab803c26eeebe511e9895013ecadfdd3ebe;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 e78fb4d..0664f20 100644 --- a/src/main/java/com/indexdata/pz2utils4jsf/errors/ErrorHelper.java +++ b/src/main/java/com/indexdata/pz2utils4jsf/errors/ErrorHelper.java @@ -9,7 +9,7 @@ import java.util.regex.Pattern; import org.apache.log4j.Logger; -import com.indexdata.pz2utils4jsf.config.Pz2Configurator; +import com.indexdata.pz2utils4jsf.config.ConfigurationReader; import com.indexdata.pz2utils4jsf.utils.Utils; public class ErrorHelper implements Serializable { @@ -32,9 +32,9 @@ public class ErrorHelper implements Serializable { private static Logger logger = Logger.getLogger(ErrorHelper.class); - private Pz2Configurator configurator = null; + private ConfigurationReader configurator = null; - public ErrorHelper(Pz2Configurator configurator) { + public ErrorHelper(ConfigurationReader configurator) { this.configurator = configurator; } @@ -64,9 +64,9 @@ public class ErrorHelper implements Serializable { return ErrorCode.SKIP_SUGGESTIONS; } else if (errmsg.contains("Missing mandatory parameter")) { return ErrorCode.MISSING_MANDATORY_PROPERTY; - } else if (errmsg.contains("Pz2ConfigureByMk2Config") && errmsg.contains("Init parameter") && (errmsg.contains("missing"))) { + } else if (errmsg.contains("ConfigureByMk2Config") && errmsg.contains("Init parameter") && (errmsg.contains("missing"))) { return ErrorCode.MISSING_MK2_CONFIG_INIT_PARAMETER; - } else if (appError.getMessage().contains("Pz2ConfigureByWebXml could not find mandatory context-param")) { + } else if (appError.getMessage().contains("WebXmlConfigReader could not find mandatory context-param")) { return ErrorCode.MISSING_CONTEXT_PARAMETER; } return ErrorCode.NOT_RESOLVED; @@ -78,13 +78,13 @@ public class ErrorHelper implements Serializable { switch (code) { case MISSING_MK2_CONFIG_INIT_PARAMETER: suggestions.add("A mandatory init parameter (context-param) was not found in the deployment descriptor (web.xml)." + - " Following init parameters must be present when using the MasterKey configuration scheme (Pz2ConfigureByMk2Config):" + + " Following init parameters must be present when using the MasterKey configuration scheme (ConfigureByMk2Config):" + " MASTERKEY_ROOT_CONFIG_DIR (i.e. '/etc/masterkey'), MASTERKEY_COMPONENT_CONFIG_DIR (i.e. '/myapp'), " + " MASTERKEY_CONFIG_FILE_NAME (i.e. 'myapp.properties'"); break; case MISSING_CONTEXT_PARAMETER: suggestions.add("A mandatory init parameter (context-param) was not found in the deployment descriptor (web.xml)." + - " Following init parameters must be present when using Pz2ConfigureByWebXml:" + + " Following init parameters must be present when using WebXmlConfigReader:" + " PAZPAR2_URL, PAZPAR2_SERVICE_ID"); break; case MISSING_MANDATORY_PROPERTY: @@ -121,18 +121,24 @@ public class ErrorHelper implements Serializable { + "that a pazpar2 service is running at the given address." + nl); break; case PAZPAR2_ERRORS: - if (error.hasPazpar2Error()) { - String pz2code = error.getPazpar2Error().getCode(); + if (error.hasPazpar2Error()) { + int pz2code = Integer.parseInt(error.getPazpar2Error().getCode()); switch (pz2code) { - case "3": + case 3: suggestions.add("Query terms not supported."); break; - case "12": + case 12: suggestions.add("The Pazpar2 server does not have a service defined by the requested ID "); suggestions.add("Please check the service ID set in the configuration and compare it with the " + " configuration on the Pazpar2 server-side."); addConfigurationDocumentation(suggestions); - break; + break; + case 100: + suggestions.add("Pazpar2 Service Proxy error"); + suggestions.add("A request was made to the Pazpar2 Service Proxy, but the Service Proxy reports "); + suggestions.add(" that authentication is lacking. Could be no successful authentication request was made or"); + suggestions.add(" that the Service Proxy session timed out."); + break; default: suggestions.add("Pazpar2 error: " + error.getPazpar2Error().getMsg() + " (Pazpar2 # "+error.getPazpar2Error().getCode()+")"); } @@ -145,7 +151,7 @@ public class ErrorHelper implements Serializable { break; case NOT_RESOLVED: suggestions.add("Sorry, no troubleshooting suggestions were written for this error scenario just yet."); - break; + break; } return suggestions; }