Skip to content

Commit dee50e3

Browse files
joaodinissfclaude
andcommitted
fix: use try-with-resources in ProjectBasedTests.isEmpty()
Fixes PMD UseTryWithResources violation introduced during Xtend-to-Java migration, now that upstream enabled this rule. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 7f1c38e commit dee50e3

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

com.avaloq.tools.ddk.check.core.test/src/com/avaloq/tools/ddk/check/core/test/ProjectBasedTests.java

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -61,17 +61,12 @@ public void initializeTestProject() {
6161
}
6262

6363
private boolean isEmpty(final IFile file) throws CoreException {
64-
final InputStream s = file.getContents();
65-
try {
64+
try (InputStream s = file.getContents()) {
6665
return s.read() < 0;
66+
} catch (CoreException e) {
67+
throw e;
6768
} catch (Exception e) {
6869
throw new IllegalStateException(e);
69-
} finally {
70-
try {
71-
s.close();
72-
} catch (Exception e) {
73-
// ignore
74-
}
7570
}
7671
}
7772

0 commit comments

Comments
 (0)