From: Niels Erik G. Nielsen Date: Mon, 13 May 2013 19:18:23 +0000 (-0400) Subject: Fixes err msg bug. Adds status field to error xml. X-Git-Tag: v0.0.7~106 X-Git-Url: http://lists.indexdata.dk/?a=commitdiff_plain;h=89c5216a9334ca77f534054ffcaf3ca74a2f7ced;p=mkjsf-moved-to-github.git 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. --- 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; }