From 332204f1699f9b7d5714d7e5c49dbe8edaf94d32 Mon Sep 17 00:00:00 2001 From: "Niels Erik G. Nielsen" Date: Fri, 5 Apr 2013 17:44:54 -0400 Subject: [PATCH] Downgrades to Java 1.6 to run demo on Debian Wheezy --- pom.xml | 4 ++-- .../com/indexdata/pz2utils4jsf/errors/ErrorHelper.java | 12 ++++++------ .../pz2utils4jsf/pazpar2/sp/ServiceProxyClient.java | 5 ++--- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/pom.xml b/pom.xml index 567fde3..2df0cf2 100644 --- a/pom.xml +++ b/pom.xml @@ -65,8 +65,8 @@ src/META-INF/ - 1.7 - 1.7 + 1.6 + 1.6 diff --git a/src/main/java/com/indexdata/pz2utils4jsf/errors/ErrorHelper.java b/src/main/java/com/indexdata/pz2utils4jsf/errors/ErrorHelper.java index 874c50f..0664f20 100644 --- a/src/main/java/com/indexdata/pz2utils4jsf/errors/ErrorHelper.java +++ b/src/main/java/com/indexdata/pz2utils4jsf/errors/ErrorHelper.java @@ -121,19 +121,19 @@ 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; - case "100": + 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"); @@ -151,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; } diff --git a/src/main/java/com/indexdata/pz2utils4jsf/pazpar2/sp/ServiceProxyClient.java b/src/main/java/com/indexdata/pz2utils4jsf/pazpar2/sp/ServiceProxyClient.java index 16eea35..e881506 100644 --- a/src/main/java/com/indexdata/pz2utils4jsf/pazpar2/sp/ServiceProxyClient.java +++ b/src/main/java/com/indexdata/pz2utils4jsf/pazpar2/sp/ServiceProxyClient.java @@ -2,10 +2,8 @@ package com.indexdata.pz2utils4jsf.pazpar2.sp; import static com.indexdata.pz2utils4jsf.utils.Utils.nl; -import java.io.BufferedWriter; import java.io.ByteArrayOutputStream; import java.io.File; -import java.io.FileWriter; import java.io.IOException; import java.nio.file.Path; import java.nio.file.Paths; @@ -13,7 +11,6 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.Scanner; import javax.enterprise.context.SessionScoped; import javax.inject.Named; @@ -241,6 +238,7 @@ public class ServiceProxyClient implements SearchClient { File initDoc = new File(filePath); logger.info("Posting to SP: "); Path path = Paths.get(filePath); + /* if (logger.isDebugEnabled()) { try (Scanner scanner = new Scanner(path, "UTF-8")){ while (scanner.hasNextLine()){ @@ -248,6 +246,7 @@ public class ServiceProxyClient implements SearchClient { } } } + */ post.setEntity(new FileEntity(initDoc)); byte[] response = client.execute(post, handler); logger.info("Response on POST was: " + new String(response,"UTF-8")); -- 1.7.10.4