diff --git a/extensions/expath/pom.xml b/extensions/expath/pom.xml index 4d2631c7009..49837c5c31a 100644 --- a/extensions/expath/pom.xml +++ b/extensions/expath/pom.xml @@ -71,7 +71,7 @@ org.expath.http.client http-client-java - 1.4.1 + 1.5.2 diff --git a/extensions/expath/src/main/java/org/expath/httpclient/model/exist/EXistResult.java b/extensions/expath/src/main/java/org/expath/httpclient/model/exist/EXistResult.java index c5ddb470034..6b24fd70c6c 100644 --- a/extensions/expath/src/main/java/org/expath/httpclient/model/exist/EXistResult.java +++ b/extensions/expath/src/main/java/org/expath/httpclient/model/exist/EXistResult.java @@ -39,12 +39,20 @@ import org.exist.xquery.XPathException; import org.exist.xquery.XQueryContext; import org.exist.xquery.modules.ModuleUtils; -import org.exist.xquery.value.*; +import org.exist.xquery.value.Base64BinaryValueType; +import org.exist.xquery.value.BinaryValueFromFile; +import org.exist.xquery.value.NodeValue; +import org.exist.xquery.value.Sequence; +import org.exist.xquery.value.StringValue; +import org.exist.xquery.value.Type; +import org.exist.xquery.value.ValueSequence; import org.expath.httpclient.HttpClientException; import org.expath.httpclient.HttpResponse; import org.expath.httpclient.model.Result; import org.xml.sax.SAXException; +import static org.expath.httpclient.HttpClientError.HC001; + /** * @author Adam Retter */ @@ -78,7 +86,7 @@ public void add(final Reader reader, final Charset charset) throws HttpClientExc builder.append(cbuf, 0, read); } } catch(final IOException ioe) { - throw new HttpClientException("Unable to add string value to result: " + ioe.getMessage(), ioe); + throw new HttpClientException(HC001, "Unable to add string value to result: " + ioe.getMessage(), ioe); } finally { try { reader.close(); @@ -101,7 +109,7 @@ public void add(final InputStream is) throws HttpClientException { result.add(BinaryValueFromFile.getInstance(context, new Base64BinaryValueType(), tempFile, (isClosed, file) -> temporaryFileManager.returnTemporaryFile(file), null)); } catch(final XPathException | IOException xpe) { - throw new HttpClientException("Unable to add binary value to result:" + xpe.getMessage(), xpe); + throw new HttpClientException(HC001, "Unable to add binary value to result:" + xpe.getMessage(), xpe); } finally { try { is.close(); @@ -117,7 +125,7 @@ public void add(final Source src) throws HttpClientException { final NodeValue nodeValue = ModuleUtils.sourceToXML(context, src, null); result.add(nodeValue); } catch(final SAXException | IOException saxe) { - throw new HttpClientException("Unable to add Source to result:" + saxe.getMessage(), saxe); + throw new HttpClientException(HC001, "Unable to add Source to result:" + saxe.getMessage(), saxe); } } @@ -141,7 +149,7 @@ public void add(final HttpResponse response) throws HttpClientException { result = newResult; } } catch (final XPathException xpe) { - throw new HttpClientException("Unable to add HttpResponse to result:" + xpe.getMessage(), xpe); + throw new HttpClientException(HC001, "Unable to add HttpResponse to result:" + xpe.getMessage(), xpe); } } diff --git a/extensions/expath/src/main/java/org/expath/httpclient/model/exist/EXistTreeBuilder.java b/extensions/expath/src/main/java/org/expath/httpclient/model/exist/EXistTreeBuilder.java index 11e8d4d05f2..85da486d913 100644 --- a/extensions/expath/src/main/java/org/expath/httpclient/model/exist/EXistTreeBuilder.java +++ b/extensions/expath/src/main/java/org/expath/httpclient/model/exist/EXistTreeBuilder.java @@ -34,6 +34,8 @@ import javax.xml.XMLConstants; +import static org.expath.httpclient.HttpClientError.HC001; + /** * @author Adam Retter */ @@ -93,7 +95,7 @@ public void outputHeaders(HeaderSet headers) endElem(); } catch ( ToolsException ex ) { - throw new HttpClientException("Error building the header " + name, ex); + throw new HttpClientException(HC001, "Error building the header " + name, ex); } } }