From 89c5216a9334ca77f534054ffcaf3ca74a2f7ced Mon Sep 17 00:00:00 2001 From: "Niels Erik G. Nielsen" Date: Mon, 13 May 2013 15:18:23 -0400 Subject: [PATCH] Fixes err msg bug. Adds status field to error xml. Fixes bug that failed to write error xml for pazpar2 417. Adds status field to error xml so the ui can do, say, search.status=='OK' even in case of a search error response. --- src/main/java/com/indexdata/mkjsf/pazpar2/ServiceProxyClient.java | 4 ++-- src/main/java/com/indexdata/mkjsf/pazpar2/data/CommandError.java | 1 + src/main/java/com/indexdata/mkjsf/pazpar2/data/SearchResponse.java | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/indexdata/mkjsf/pazpar2/ServiceProxyClient.java b/src/main/java/com/indexdata/mkjsf/pazpar2/ServiceProxyClient.java index 152ee33..5af17a0 100644 --- a/src/main/java/com/indexdata/mkjsf/pazpar2/ServiceProxyClient.java +++ b/src/main/java/com/indexdata/mkjsf/pazpar2/ServiceProxyClient.java @@ -117,9 +117,9 @@ public class ServiceProxyClient implements SearchClient { } } else { errorXml = CommandError.createErrorXml(command.getCommandName(), String.valueOf(handler.getStatusCode()), "Unexpected response type from Service Proxy: "+handler.getContentType(), "Could not process non-XML response from Service Proxy", new String(response,"UTF-8")); - } - commandResponse = new ClientCommandResponse(handler.getStatusCode(),errorXml,handler.getContentType()); + } } + commandResponse = new ClientCommandResponse(handler.getStatusCode(),errorXml,handler.getContentType()); } } catch (Exception e) { e.printStackTrace(); diff --git a/src/main/java/com/indexdata/mkjsf/pazpar2/data/CommandError.java b/src/main/java/com/indexdata/mkjsf/pazpar2/data/CommandError.java index 7680ae5..ede8767 100644 --- a/src/main/java/com/indexdata/mkjsf/pazpar2/data/CommandError.java +++ b/src/main/java/com/indexdata/mkjsf/pazpar2/data/CommandError.java @@ -75,6 +75,7 @@ public class CommandError extends ResponseDataObject implements ErrorInterface { errorXml.append("<" + commandName + ">"+nl); errorXml.append(" "+nl); errorXml.append(" " + commandName + ""+nl); + errorXml.append(" FAIL"+nl); errorXml.append(" " + statusCode + ""+nl); errorXml.append(" " + (exception != null ? XmlUtils.escape(exception) : "") + ""+nl); errorXml.append(" " + (errorMessage != null ? XmlUtils.escape(errorMessage) : "") + ""+nl); diff --git a/src/main/java/com/indexdata/mkjsf/pazpar2/data/SearchResponse.java b/src/main/java/com/indexdata/mkjsf/pazpar2/data/SearchResponse.java index c905c26..79bb667 100644 --- a/src/main/java/com/indexdata/mkjsf/pazpar2/data/SearchResponse.java +++ b/src/main/java/com/indexdata/mkjsf/pazpar2/data/SearchResponse.java @@ -8,7 +8,7 @@ public class SearchResponse extends ResponseDataObject { public String getStatus() { return getOneElementValue("status"); } - + public boolean isNew () { return isNew; } -- 1.7.10.4