aboutsummaryrefslogtreecommitdiffstats
path: root/datarouter-node/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'datarouter-node/src/main/java')
-rw-r--r--datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/NodeServlet.java11
1 files changed, 10 insertions, 1 deletions
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) {