From 1979daeb2b383b6a7bccda7c2f5dd7fe4bca612a Mon Sep 17 00:00:00 2001 From: Fiachra Corcoran Date: Wed, 17 Oct 2018 16:08:38 +0100 Subject: Reverting changes from DMAAP-775 Change-Id: If9fde76bbd606f40a67ff1181d08db25b0b563d7 Signed-off-by: Fiachra Corcoran Issue-ID: DMAAP-850 --- .../main/java/org/onap/dmaap/datarouter/node/NodeServlet.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/NodeServlet.java b/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/NodeServlet.java index 26513358..a223b98c 100644 --- a/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/NodeServlet.java +++ b/datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/NodeServlet.java @@ -282,8 +282,9 @@ public class NodeServlet extends HttpServlet { File data = new File(fbase); File meta = new File(fbase + ".M"); OutputStream dos = null; + Writer mw = null; InputStream is = null; - try (Writer mw = new FileWriter(meta)) { + try { StringBuffer mx = new StringBuffer(); mx.append(req.getMethod()).append('\t').append(fileid).append('\n'); Enumeration hnames = req.getHeaderNames(); @@ -357,10 +358,12 @@ public class NodeServlet extends HttpServlet { } String dbase = di.getSpool() + "/" + pubid; Files.createLink(Paths.get(dbase), dpath); + mw = new FileWriter(meta); mw.write(metadata); if (di.getSubId() == null) { mw.write("X-ATT-DR-ROUTING\t" + t.getRouting() + "\n"); } + mw.close(); meta.renameTo(new File(dbase + ".M")); } resp.setStatus(HttpServletResponse.SC_NO_CONTENT); @@ -385,6 +388,12 @@ public class NodeServlet extends HttpServlet { } catch (Exception e) { } } + if (mw != null) { + try { + mw.close(); + } catch (Exception e) { + } + } try { data.delete(); } catch (Exception e) { -- cgit 1.2.3-korg