aboutsummaryrefslogtreecommitdiffstats
path: root/sdnr/wt/odlux/core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/odlux/ResFilesServlet.java
diff options
context:
space:
mode:
Diffstat (limited to 'sdnr/wt/odlux/core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/odlux/ResFilesServlet.java')
-rw-r--r--sdnr/wt/odlux/core/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/odlux/ResFilesServlet.java20
1 files changed, 14 insertions, 6 deletions
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);
}
}