Repository: flink Updated Branches: refs/heads/master eef0db090 -> b2cac3a2a
[FLINK-7807] [REST] Log exceptions in HandlerUtils methods This closes #7807. Project: http://git-wip-us.apache.org/repos/asf/flink/repo Commit: http://git-wip-us.apache.org/repos/asf/flink/commit/a9c13c7d Tree: http://git-wip-us.apache.org/repos/asf/flink/tree/a9c13c7d Diff: http://git-wip-us.apache.org/repos/asf/flink/diff/a9c13c7d Branch: refs/heads/master Commit: a9c13c7d90253cc59749c20e6ee6e7f790cb598a Parents: e2ae45b Author: zentol <[email protected]> Authored: Wed Oct 11 13:43:40 2017 +0200 Committer: zentol <[email protected]> Committed: Wed Oct 11 22:06:58 2017 +0200 ---------------------------------------------------------------------- .../apache/flink/runtime/rest/handler/util/HandlerUtils.java | 6 ++++++ 1 file changed, 6 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flink/blob/a9c13c7d/flink-runtime/src/main/java/org/apache/flink/runtime/rest/handler/util/HandlerUtils.java ---------------------------------------------------------------------- diff --git a/flink-runtime/src/main/java/org/apache/flink/runtime/rest/handler/util/HandlerUtils.java b/flink-runtime/src/main/java/org/apache/flink/runtime/rest/handler/util/HandlerUtils.java index 0d7483a..7c37998 100644 --- a/flink-runtime/src/main/java/org/apache/flink/runtime/rest/handler/util/HandlerUtils.java +++ b/flink-runtime/src/main/java/org/apache/flink/runtime/rest/handler/util/HandlerUtils.java @@ -36,6 +36,8 @@ import org.apache.flink.shaded.netty4.io.netty.handler.codec.http.HttpResponseSt import org.apache.flink.shaded.netty4.io.netty.handler.codec.http.LastHttpContent; import com.fasterxml.jackson.databind.ObjectMapper; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import javax.annotation.Nonnull; @@ -51,6 +53,8 @@ import static org.apache.flink.shaded.netty4.io.netty.handler.codec.http.HttpVer */ public class HandlerUtils { + private static final Logger LOG = LoggerFactory.getLogger(HandlerUtils.class); + private static final ObjectMapper mapper = RestMapperUtils.getStrictObjectMapper(); /** @@ -71,6 +75,7 @@ public class HandlerUtils { try { mapper.writeValue(sw, response); } catch (IOException ioe) { + LOG.error("Internal server error. Could not map response to JSON.", ioe); sendErrorResponse(channelHandlerContext, httpRequest, new ErrorResponseBody("Internal server error. Could not map response to JSON."), HttpResponseStatus.INTERNAL_SERVER_ERROR); return; } @@ -96,6 +101,7 @@ public class HandlerUtils { mapper.writeValue(sw, errorMessage); } catch (IOException e) { // this should never happen + LOG.error("Internal server error. Could not map error response to JSON.", e); sendResponse(channelHandlerContext, httpRequest, "Internal server error. Could not map error response to JSON.", HttpResponseStatus.INTERNAL_SERVER_ERROR); } sendResponse(channelHandlerContext, httpRequest, sw.toString(), statusCode);
