Skip to content

Commit 851b4f6

Browse files
authored
Merge pull request #6959 from chrisrueger/close-jar
fix resource leak
2 parents f7becb4 + 08ce121 commit 851b4f6

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

biz.aQute.bndlib/src/aQute/bnd/build/ProjectBuilder.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -224,10 +224,11 @@ public void init() {
224224
if ((c.getType() == TYPE.PROJECT) && !file.exists()) {
225225
continue;
226226
}
227-
Jar jar = new Jar(file);
228227
Map<String, String> containerAttributes = c.getAttributes();
229228
if (!Boolean.parseBoolean(containerAttributes.getOrDefault("maven-optional", "false"))) {
230-
fillDependencies(dependencies, jar, containerAttributes);
229+
try (Jar jar = new Jar(file)) {
230+
fillDependencies(dependencies, jar, containerAttributes);
231+
}
231232
}
232233
}
233234
}

0 commit comments

Comments
 (0)