From 52b602ed2e8ca7cbad266b59c45e916cb8394b56 Mon Sep 17 00:00:00 2001 From: Johannes Dahlström Date: Tue, 12 May 2015 12:03:40 +0300 Subject: Catch all Exceptions when trying to open a gzipped resource (#13653) URLConnection.getInputStream may throw any IOException, not just FileNotFoundException. Additionally, catch and log unexpected non-IOExceptions just in case to keep the app from failing hard. Change-Id: Id7ce7ddee3de38ccd10d9e02e6c587a86b9cac96 --- server/src/com/vaadin/server/VaadinServlet.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'server') diff --git a/server/src/com/vaadin/server/VaadinServlet.java b/server/src/com/vaadin/server/VaadinServlet.java index 053349a635..b30f6acf16 100644 --- a/server/src/com/vaadin/server/VaadinServlet.java +++ b/server/src/com/vaadin/server/VaadinServlet.java @@ -877,8 +877,13 @@ public class VaadinServlet extends HttpServlet implements Constants { is = connection.getInputStream(); // set gzip headers response.setHeader("Content-Encoding", "gzip"); - } catch (FileNotFoundException e) { + } catch (IOException e) { // NOP: will be still tried with non gzipped version + } catch (Exception e) { + getLogger().log( + Level.FINE, + "Unexpected exception looking for gzipped version of resource " + + urlStr, e); } } if (is == null) { -- cgit v1.2.3