Browse Source

Polish

pull/38706/head
Moritz Halbritter 2 years ago
parent
commit
6a65ca13ea
  1. 9
      spring-boot-project/spring-boot-docker-compose/src/test/java/org/springframework/boot/docker/compose/service/connection/test/AbstractDockerComposeIntegrationTests.java

9
spring-boot-project/spring-boot-docker-compose/src/test/java/org/springframework/boot/docker/compose/service/connection/test/AbstractDockerComposeIntegrationTests.java

@ -83,9 +83,14 @@ public abstract class AbstractDockerComposeIntegrationTests { @@ -83,9 +83,14 @@ public abstract class AbstractDockerComposeIntegrationTests {
private File transformedComposeFile(File composeFile, DockerImageName imageName) {
File tempComposeFile = Path.of(tempDir.toString(), composeFile.getName()).toFile();
try {
String composeFileContent = FileCopyUtils.copyToString(new FileReader(composeFile));
String composeFileContent;
try (FileReader reader = new FileReader(composeFile)) {
composeFileContent = FileCopyUtils.copyToString(reader);
}
composeFileContent = composeFileContent.replace("{imageName}", imageName.asCanonicalNameString());
FileCopyUtils.copy(composeFileContent, new FileWriter(tempComposeFile));
try (FileWriter writer = new FileWriter(tempComposeFile)) {
FileCopyUtils.copy(composeFileContent, writer);
}
}
catch (IOException ex) {
fail("Error transforming Docker compose file '" + composeFile + "' to '" + tempComposeFile + "': "

Loading…
Cancel
Save