private QueryExceptionHTTP rewrap(HttpException httpEx) { // The historical contract of HTTP Queries has been to throw QueryExceptionHTTP however using the standard // ARQ HttpOp machinery we use these days means the internal HTTP errors come back as HttpException // Therefore we need to wrap appropriately responseCode = httpEx.getResponseCode(); if (responseCode != -1) { // Was an actual HTTP error String responseLine = httpEx.getStatusLine() != null ? httpEx.getStatusLine() : "No Status Line"; return new QueryExceptionHTTP(responseCode, "HTTP " + responseCode + " error making the query: " + responseLine, httpEx); } else if (httpEx.getMessage() != null) { // Some non-HTTP error with a valid message e.g. Socket Communications failed, IO error return new QueryExceptionHTTP(responseCode, "Unexpected error making the query: " + httpEx.getMessage(), httpEx); } else if (httpEx.getCause() != null) { // Some other error with a cause e.g. Socket Communications failed, IO error return new QueryExceptionHTTP(responseCode, "Unexpected error making the query, see cause for further details", httpEx); } else { // Some other error with no message and no further cause return new QueryExceptionHTTP(responseCode, "Unexpected error making the query", httpEx); } }
public void sync() { try { checkDeltaConnection(); PatchLogInfo logInfo = getPatchLogInfo(); sync(logInfo); } catch (HttpException ex) { if ( ex.getResponseCode() == -1 ) throw new HttpException(HttpSC.SERVICE_UNAVAILABLE_503, HttpSC.getMessage(HttpSC.SERVICE_UNAVAILABLE_503), ex.getMessage()); throw ex; } }
@Override protected Graph getVocabulary(final String url) { final Graph graph = createDefaultGraph(); try { RDFParser.source(url).httpAccept("application/ld+json").parse(graph); } catch (final HttpException ex) { LOGGER.warn("Could not fetch {}: {}", url, ex.getMessage()); assumeTrue(false, "Error fetching the URL (" + url + "): skip the test"); } return graph; }
} catch (HttpException ex) { if ( HttpSC.BAD_REQUEST_400 == ex.getResponseCode() ) { throw new DeltaBadRequestException(ex.getMessage());
} catch (HttpException ex) { if ( ex.getMessage() == null ) ServletOps.responseSendError(response, ex.getResponseCode()); else ServletOps.responseSendError(response, ex.getResponseCode(), ex.getMessage()); } catch (RuntimeIOException ex) { log.warn(format("[%d] Runtime IO Exception (client left?) RC = %d : %s", id, HttpSC.INTERNAL_SERVER_ERROR_500, ex.getMessage()), ex) ;
} catch (HttpException ex) { if ( ex.getMessage() == null ) ServletOps.responseSendError(response, ex.getResponseCode()); else ServletOps.responseSendError(response, ex.getResponseCode(), ex.getMessage()); } catch (RuntimeIOException ex) { log.warn(format("[%d] Runtime IO Exception (client left?) RC = %d : %s", id, HttpSC.INTERNAL_SERVER_ERROR_500, ex.getMessage()), ex) ;
} catch (HttpException ex) { if ( ex.getResponseCode() != HttpSC.METHOD_NOT_ALLOWED_405 ) System.err.println("Unexpected HTTP Response Code: "+ex.getMessage()); else System.out.println("DELETE rejected correctly: "+ex.getMessage());
} catch (HttpException ex) { if ( ex.getResponseCode() != HttpSC.METHOD_NOT_ALLOWED_405 ) System.err.println("Unexpected HTTP Response Code: "+ex.getMessage()); else System.out.println("DELETE rejected correctly: "+ex.getMessage());
} catch (HttpException ex) { if ( ex.getResponseCode() != HttpSC.METHOD_NOT_ALLOWED_405 ) System.err.println("Unexpected HTTP Response Code: "+ex.getMessage()); else System.out.println("DELETE rejected correctly: "+ex.getMessage());