srdo commented on a change in pull request #3101: STORM-1515: Fix LocalState
Corruption
URL: https://github.com/apache/storm/pull/3101#discussion_r318642604
##########
File path: storm-server/src/test/java/org/apache/storm/LocalStateTest.java
##########
@@ -57,15 +57,36 @@ public void testLocalState() throws Exception {
@Test
public void testEmptyState() throws IOException {
- TmpPath tmp_dir = new TmpPath();
- String dir = tmp_dir.getPath();
- LocalState ls = new LocalState(dir, true);
- GlobalStreamId gs_a = new GlobalStreamId("a", "a");
- FileOutputStream data = FileUtils.openOutputStream(new File(dir,
"12345"));
- FileOutputStream version = FileUtils.openOutputStream(new File(dir,
"12345.version"));
- Assert.assertNull(ls.get("c"));
- ls.put("a", gs_a);
- Assert.assertEquals(gs_a, ls.get("a"));
+ try (TmpPath tmp_dir = new TmpPath()) {
+ GlobalStreamId globalStreamId_a = new GlobalStreamId("a", "a");
+
+ String dir = tmp_dir.getPath();
+ LocalState ls = new LocalState(dir, true);
+
+ FileOutputStream data = FileUtils.openOutputStream(new File(dir,
"12345"));
Review comment:
These streams are still not being closed. I think you can use try with
resources for them too
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services