diff --git a/core/src/main/java/org/mapfish/print/http/ErrorResponseClientHttpResponse.java b/core/src/main/java/org/mapfish/print/http/ErrorResponseClientHttpResponse.java index 61e59196a4..b04082b546 100644 --- a/core/src/main/java/org/mapfish/print/http/ErrorResponseClientHttpResponse.java +++ b/core/src/main/java/org/mapfish/print/http/ErrorResponseClientHttpResponse.java @@ -9,8 +9,8 @@ public class ErrorResponseClientHttpResponse extends AbstractClientHttpResponse { private final Exception exception; - /** HTTP code use in response for non HTTP errors. */ - private static final int FAKE_HTTP_ERROR_CODE = 999; + /** HTTP code use in response for non HTTP errors, (Not Acceptable). */ + private static final int FAKE_HTTP_ERROR_CODE = 406; public ErrorResponseClientHttpResponse(final Exception e) { assert e != null; diff --git a/core/src/main/java/org/mapfish/print/map/geotools/FeaturesParser.java b/core/src/main/java/org/mapfish/print/map/geotools/FeaturesParser.java index d4e3e45891..9d84a43b91 100644 --- a/core/src/main/java/org/mapfish/print/map/geotools/FeaturesParser.java +++ b/core/src/main/java/org/mapfish/print/map/geotools/FeaturesParser.java @@ -93,7 +93,7 @@ static final CoordinateReferenceSystem parseCoordinateReferenceSystem( requestFactory.createRequest(new URI(uri), HttpMethod.GET); try (ClientHttpResponse response = request.execute()) { - if (response.getStatusCode() == HttpStatus.OK) { + if (response.getRawStatusCode() == HttpStatus.OK.value()) { final String wkt = IOUtils.toString(response.getBody(), Constants.DEFAULT_ENCODING); try { diff --git a/core/src/main/java/org/mapfish/print/map/image/AbstractSingleImageLayer.java b/core/src/main/java/org/mapfish/print/map/image/AbstractSingleImageLayer.java index 2082c70b15..9ce0821658 100644 --- a/core/src/main/java/org/mapfish/print/map/image/AbstractSingleImageLayer.java +++ b/core/src/main/java/org/mapfish/print/map/image/AbstractSingleImageLayer.java @@ -202,14 +202,15 @@ private boolean isResponseStatusCodeValid( final String stringBody, final String baseMetricName) throws IOException { - if (httpResponse.getStatusCode() != HttpStatus.OK) { + if (httpResponse.getRawStatusCode() != HttpStatus.OK.value()) { String message = String.format( - "Invalid status code for %s (%d!=%d).With request headers:\n%s\n" + "Invalid status code for %s (%d!=%d), status: %s. With request headers:\n%s\n" + "The response was: '%s'\nWith response headers:\n%s", request.getURI(), - httpResponse.getStatusCode().value(), + httpResponse.getRawStatusCode(), HttpStatus.OK.value(), + httpResponse.getStatusText(), String.join("\n", Utils.getPrintableHeadersList(request.getHeaders())), httpResponse.getStatusText(), String.join("\n", Utils.getPrintableHeadersList(httpResponse.getHeaders()))); diff --git a/core/src/main/java/org/mapfish/print/map/style/ParserPluginUtils.java b/core/src/main/java/org/mapfish/print/map/style/ParserPluginUtils.java index 379aba9a80..d965fabb8d 100644 --- a/core/src/main/java/org/mapfish/print/map/style/ParserPluginUtils.java +++ b/core/src/main/java/org/mapfish/print/map/style/ParserPluginUtils.java @@ -34,7 +34,7 @@ public static Optional