summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJon Marius Venstad <venstad@gmail.com>2020-10-01 20:29:40 +0200
committerJon Marius Venstad <venstad@gmail.com>2020-10-01 20:29:40 +0200
commitf1aa2bb7fa9342c6dfdd0bf29b645d48e37247cb (patch)
tree17856791faaff9cd763fc5cc57fd86a289c91c3f
parent7983d163ea4fe9154b2abc79185e38c70dcf11a3 (diff)
Only catch LinkageError in addition to RuntimeException
-rw-r--r--vespaclient-container-plugin/src/main/java/com/yahoo/document/restapi/DocumentOperationExecutorImpl.java2
-rw-r--r--vespaclient-container-plugin/src/main/java/com/yahoo/document/restapi/resource/DocumentV1ApiHandler.java14
2 files changed, 8 insertions, 8 deletions
diff --git a/vespaclient-container-plugin/src/main/java/com/yahoo/document/restapi/DocumentOperationExecutorImpl.java b/vespaclient-container-plugin/src/main/java/com/yahoo/document/restapi/DocumentOperationExecutorImpl.java
index 135b6a824c8..a4a36026fc5 100644
--- a/vespaclient-container-plugin/src/main/java/com/yahoo/document/restapi/DocumentOperationExecutorImpl.java
+++ b/vespaclient-container-plugin/src/main/java/com/yahoo/document/restapi/DocumentOperationExecutorImpl.java
@@ -221,7 +221,7 @@ public class DocumentOperationExecutorImpl implements DocumentOperationExecutor
catch (IllegalArgumentException | ParseException e) {
context.error(BAD_REQUEST, Exceptions.toMessageString(e));
}
- catch (RuntimeException e) {
+ catch (RuntimeException | LinkageError e) {
context.error(ERROR, Exceptions.toMessageString(e));
}
}
diff --git a/vespaclient-container-plugin/src/main/java/com/yahoo/document/restapi/resource/DocumentV1ApiHandler.java b/vespaclient-container-plugin/src/main/java/com/yahoo/document/restapi/resource/DocumentV1ApiHandler.java
index 98bbb029ea8..bb1dd8f20c4 100644
--- a/vespaclient-container-plugin/src/main/java/com/yahoo/document/restapi/resource/DocumentV1ApiHandler.java
+++ b/vespaclient-container-plugin/src/main/java/com/yahoo/document/restapi/resource/DocumentV1ApiHandler.java
@@ -166,7 +166,7 @@ public class DocumentV1ApiHandler extends AbstractRequestHandler {
catch (IllegalArgumentException e) {
return badRequest(request, e, responseHandler);
}
- catch (RuntimeException e) {
+ catch (RuntimeException | LinkageError e) {
return serverError(request, e, responseHandler);
}
}
@@ -250,7 +250,7 @@ public class DocumentV1ApiHandler extends AbstractRequestHandler {
}
}
// TODO jonmv: This shouldn't happen much, but ... expose errors too?
- catch (RuntimeException e) {
+ catch (RuntimeException | LinkageError e) {
log.log(WARNING, "Exception serializing document in document/v1 visit response", e);
}
});
@@ -296,7 +296,7 @@ public class DocumentV1ApiHandler extends AbstractRequestHandler {
catch (IllegalArgumentException e) {
badRequest(request, e, handler);
}
- catch (RuntimeException e) {
+ catch (RuntimeException | LinkageError e) {
serverError(request, e, handler);
}
});
@@ -318,7 +318,7 @@ public class DocumentV1ApiHandler extends AbstractRequestHandler {
catch (IllegalArgumentException e) {
badRequest(request, e, handler);
}
- catch (RuntimeException e) {
+ catch (RuntimeException | LinkageError e) {
serverError(request, e, handler);
}
});
@@ -423,10 +423,10 @@ public class DocumentV1ApiHandler extends AbstractRequestHandler {
return respond(Response.Status.TOO_MANY_REQUESTS, root, handler);
}
- private static ContentChannel serverError(HttpRequest request, RuntimeException e, ResponseHandler handler) {
- log.log(WARNING, "Uncaught exception handling request " + request.getMethod() + " " + request.getUri().getRawPath() + ":", e);
+ private static ContentChannel serverError(HttpRequest request, Throwable t, ResponseHandler handler) {
+ log.log(WARNING, "Uncaught exception handling request " + request.getMethod() + " " + request.getUri().getRawPath() + ":", t);
Cursor root = responseRoot(request);
- root.setString("message", Exceptions.toMessageString(e));
+ root.setString("message", Exceptions.toMessageString(t));
return respond(Response.Status.INTERNAL_SERVER_ERROR, root, handler);
}