From 11d2ec53b9cc123faecf06b3293549015a6e53a9 Mon Sep 17 00:00:00 2001 From: Peter Malone Date: Sun, 5 Feb 2017 00:45:25 -0500 Subject: [PATCH] Added exception handling to BackendHttpServlet. --- .../redhat/examples/backend/BackendHttpServlet.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/backend/src/main/java/com/redhat/examples/backend/BackendHttpServlet.java b/backend/src/main/java/com/redhat/examples/backend/BackendHttpServlet.java index 7c02acc..657489b 100644 --- a/backend/src/main/java/com/redhat/examples/backend/BackendHttpServlet.java +++ b/backend/src/main/java/com/redhat/examples/backend/BackendHttpServlet.java @@ -45,8 +45,14 @@ protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws Se response.setTime(System.currentTimeMillis()); response.setIp(getIp()); - PrintWriter out = resp.getWriter(); - mapper.writerWithDefaultPrettyPrinter().writeValue(out, response); + PrintWriter out; + try { + out = resp.getWriter(); + mapper.writerWithDefaultPrettyPrinter().writeValue(out, response); + + } catch(IOException ioe) { + throw ioe; + } } private String getIp() {