From 2fdc29b885dc6ddf0208273a76faa9f3e4194d47 Mon Sep 17 00:00:00 2001 From: Phillip Webb Date: Sun, 13 Aug 2023 19:00:04 -0700 Subject: [PATCH] Revert "Polish" This reverts commit 6a65ca13ea642bc7060cdae848bb3fa4e71576da since FileCopyUtils will close the reader/writer. --- .../test/AbstractDockerComposeIntegrationTests.java | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/spring-boot-project/spring-boot-docker-compose/src/test/java/org/springframework/boot/docker/compose/service/connection/test/AbstractDockerComposeIntegrationTests.java b/spring-boot-project/spring-boot-docker-compose/src/test/java/org/springframework/boot/docker/compose/service/connection/test/AbstractDockerComposeIntegrationTests.java index 970d9cb9360..b282af843d5 100644 --- a/spring-boot-project/spring-boot-docker-compose/src/test/java/org/springframework/boot/docker/compose/service/connection/test/AbstractDockerComposeIntegrationTests.java +++ b/spring-boot-project/spring-boot-docker-compose/src/test/java/org/springframework/boot/docker/compose/service/connection/test/AbstractDockerComposeIntegrationTests.java @@ -83,14 +83,9 @@ public abstract class AbstractDockerComposeIntegrationTests { private File transformedComposeFile(File composeFile, DockerImageName imageName) { File tempComposeFile = Path.of(tempDir.toString(), composeFile.getName()).toFile(); try { - String composeFileContent; - try (FileReader reader = new FileReader(composeFile)) { - composeFileContent = FileCopyUtils.copyToString(reader); - } + String composeFileContent = FileCopyUtils.copyToString(new FileReader(composeFile)); composeFileContent = composeFileContent.replace("{imageName}", imageName.asCanonicalNameString()); - try (FileWriter writer = new FileWriter(tempComposeFile)) { - FileCopyUtils.copy(composeFileContent, writer); - } + FileCopyUtils.copy(composeFileContent, new FileWriter(tempComposeFile)); } catch (IOException ex) { fail("Error transforming Docker compose file '" + composeFile + "' to '" + tempComposeFile + "': "