Skip to content

Commit ebb754a

Browse files
author
Vladimir Kotal
committed
make eftar closeable
fixes #2557
1 parent d8ea1e5 commit ebb754a

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

opengrok-indexer/src/main/java/org/opengrok/indexer/web/EftarFileReader.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
*/
2323
package org.opengrok.indexer.web;
2424

25+
import java.io.Closeable;
2526
import java.io.EOFException;
2627
import java.io.File;
2728
import java.io.FileNotFoundException;
@@ -41,7 +42,7 @@
4142
*
4243
* @author Chandan
4344
*/
44-
public class EftarFileReader {
45+
public class EftarFileReader implements Closeable {
4546

4647
private static final Logger LOGGER = LoggerFactory.getLogger(EftarFileReader.class);
4748

opengrok-web/src/test/java/org/opengrok/web/api/v1/controller/SystemControllerTest.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,10 @@ public void testDtagsEftarReload() throws IOException {
111111
// Check
112112
Path eftarPath = env.getDtagsEftarPath();
113113
assertTrue(eftarPath.toFile().exists());
114-
EftarFileReader er = new EftarFileReader(eftarPath.toString());
115-
for (int i = 0; i < descriptions.length; i++) {
116-
assertEquals(descriptions[i][1], er.get(descriptions[i][0]));
114+
try (EftarFileReader er = new EftarFileReader(eftarPath.toString())) {
115+
for (int i = 0; i < descriptions.length; i++) {
116+
assertEquals(descriptions[i][1], er.get(descriptions[i][0]));
117+
}
117118
}
118119

119120
// Cleanup

0 commit comments

Comments
 (0)