From 1cd735649775ff30a8ddff4c161f4e9e44a33d0c Mon Sep 17 00:00:00 2001 From: Clay Mayers <1301632+clay-mayers@users.noreply.github.com> Date: Mon, 18 Mar 2024 21:48:37 +0000 Subject: [PATCH] fix: Wrapped getResourceAsStream in try() (#487) --- .../src/main/java/com/netflix/hollow/ui/HollowUIRouter.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hollow-ui-tools/src/main/java/com/netflix/hollow/ui/HollowUIRouter.java b/hollow-ui-tools/src/main/java/com/netflix/hollow/ui/HollowUIRouter.java index 65ec6008c4..e41ec5f275 100644 --- a/hollow-ui-tools/src/main/java/com/netflix/hollow/ui/HollowUIRouter.java +++ b/hollow-ui-tools/src/main/java/com/netflix/hollow/ui/HollowUIRouter.java @@ -121,9 +121,9 @@ protected boolean serveResource(HttpServletRequest req, HttpServletResponse resp resp.setContentType("image/png"); } - InputStream is = this.getClass().getResourceAsStream("/" + resourceName); - - IOUtils.copy(is, resp.getOutputStream()); + try (InputStream is = this.getClass().getResourceAsStream("/" + resourceName)) { + IOUtils.copy(is, resp.getOutputStream()); + } return true; } catch(Exception e){ return false;