From a2b6dd34d73bf432846dc59c6f57dd59a03aff9b Mon Sep 17 00:00:00 2001 From: Michael Dürre Date: Thu, 8 Sep 2022 09:45:06 +0200 Subject: update odlux sources MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit update basic odlux functionality for kohn Issue-ID: CCSDK-3765 Signed-off-by: Michael Dürre Change-Id: I3723c9c2f35b9012ba537920b294a54bb556cbc6 Signed-off-by: Michael Dürre --- .../features/sdnr/wt/odlux/ResFilesServlet.java | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'sdnr/wt/odlux/core/provider/src') diff --git a/sdnr/wt/odlux/core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/odlux/ResFilesServlet.java b/sdnr/wt/odlux/core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/odlux/ResFilesServlet.java index a3f8dd7f6..c9d8a2d20 100644 --- a/sdnr/wt/odlux/core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/odlux/ResFilesServlet.java +++ b/sdnr/wt/odlux/core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/odlux/ResFilesServlet.java @@ -55,7 +55,12 @@ public class ResFilesServlet extends HttpServlet { if(f.exists()) { resp.setStatus(HttpURLConnection.HTTP_OK); resp.setContentType("image/gif"); - Files.copy(f, resp.getOutputStream()); + try { + Files.copy(f, resp.getOutputStream()); + } catch (IOException e) { + LOG.warn("Can not copy data", e); + resp.setStatus(500); + } return; } } @@ -73,16 +78,19 @@ public class ResFilesServlet extends HttpServlet { resp.setContentType(mimeType); resp.setContentLength(length); resp.setStatus(HttpURLConnection.HTTP_OK); - OutputStream os = resp.getOutputStream(); - os.write(byteContent); - os.flush(); - os.close(); + try (OutputStream os = resp.getOutputStream()) { + os.write(byteContent); + os.flush(); + } catch (IOException e) { + LOG.warn("Can not write data", e); + resp.setStatus(500); + } } else { LOG.debug("File {} not found in res.", fn); resp.setStatus(HttpURLConnection.HTTP_NOT_FOUND); } } else { - LOG.debug("BundleLoaderInstance to found.", fn); + LOG.debug("BundleLoaderInstance not found. {}", fn); resp.setStatus(HttpURLConnection.HTTP_NOT_FOUND); } } -- cgit 1.2.3-korg