diff options
Diffstat (limited to 'datarouter-node')
-rwxr-xr-x | datarouter-node/pom.xml | 8 | ||||
-rw-r--r-- | datarouter-node/src/main/java/org/onap/dmaap/datarouter/node/NodeServlet.java | 11 |
2 files changed, 11 insertions, 8 deletions
diff --git a/datarouter-node/pom.xml b/datarouter-node/pom.xml index 27d21c05..52afa663 100755 --- a/datarouter-node/pom.xml +++ b/datarouter-node/pom.xml @@ -26,7 +26,7 @@ <parent> <groupId>org.onap.dmaap.datarouter</groupId> <artifactId>parent</artifactId> - <version>1.0.3-SNAPSHOT</version> + <version>1.0.4-SNAPSHOT</version> <relativePath>../pom.xml</relativePath> </parent> <artifactId>datarouter-node</artifactId> @@ -193,12 +193,6 @@ <scope>compile</scope> </dependency> <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <version>4.10</version> - <scope>test</scope> - </dependency> - <dependency> <groupId>org.mockito</groupId> <artifactId>mockito-core</artifactId> <version>1.10.19</version> 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) { |