Skip to content

Commit

Permalink
Reduce stack trace in logs by handling empty response from service
Browse files Browse the repository at this point in the history
  • Loading branch information
ZakarFin committed Aug 15, 2023
1 parent 6600cf4 commit e4c2179
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@ protected static SimpleFeatureCollection getFeatures(String endPoint,
url = IOHelper.constructUrl(endPoint, query);
responseHeaders = OskariWFSClient.readResponseTo(endPoint, user, pass, query, baos);
response = baos.toByteArray();
if (response.length == 0) {
throw new ServiceRuntimeException("Empty response from " + url);
}
// TODO: Select parsing algorithm based on response headers (Content-Type)
fc = parseGeoJSON(response, crs, url);
if (fc != null) {
Expand All @@ -105,6 +108,9 @@ protected static SimpleFeatureCollection getFeatures(String endPoint,
baos.reset();
responseHeaders = OskariWFSClient.readResponseTo(endPoint, user, pass, query, baos);
response = baos.toByteArray();
if (response.length == 0) {
throw new ServiceRuntimeException("Empty response from " + url);
}
fc = parseGML(response, crs, url, user, pass, gmlDecoder);
if (fc != null) {
return fc;
Expand Down

0 comments on commit e4c2179

Please sign in to comment.