From f982ba35cf16b3b1bd5f2fbaf9a0d4143c89f514 Mon Sep 17 00:00:00 2001 From: Georgios Andrianakis Date: Thu, 9 Mar 2023 11:37:55 +0200 Subject: [PATCH] Properly close metadata file in integration tests Fixes: #31713 (cherry picked from commit 4d22c5fce947a49913cf3e3c0c4f79f5243d2672) --- .../java/io/quarkus/test/junit/IntegrationTestUtil.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/test-framework/junit5/src/main/java/io/quarkus/test/junit/IntegrationTestUtil.java b/test-framework/junit5/src/main/java/io/quarkus/test/junit/IntegrationTestUtil.java index f3aa07dc40270..50b565e3b9f34 100644 --- a/test-framework/junit5/src/main/java/io/quarkus/test/junit/IntegrationTestUtil.java +++ b/test-framework/junit5/src/main/java/io/quarkus/test/junit/IntegrationTestUtil.java @@ -433,9 +433,10 @@ static Properties readQuarkusArtifactProperties(ExtensionContext context) { } throw new IllegalStateException(errorMessage); } - try { - Properties properties = new Properties(); - properties.load(new FileInputStream(artifactProperties.toFile())); + + Properties properties = new Properties(); + try (var fis = new FileInputStream(artifactProperties.toFile())) { + properties.load(fis); return properties; } catch (IOException e) { throw new UncheckedIOException(