Skip to content

Commit 1b5b1cd

Browse files
krzykphilwebb
authored andcommitted
Use Files.writeString
See gh-33987
1 parent f4af93f commit 1b5b1cd

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

buildSrc/src/main/java/org/springframework/boot/build/architecture/PackageTangleCheck.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2022-2022 the original author or authors.
2+
* Copyright 2022-2023 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -19,7 +19,6 @@
1919
import java.io.File;
2020
import java.io.FileWriter;
2121
import java.io.IOException;
22-
import java.nio.charset.StandardCharsets;
2322
import java.nio.file.Files;
2423
import java.nio.file.StandardOpenOption;
2524
import java.util.stream.Collectors;
@@ -68,8 +67,7 @@ void checkForPackageTangles() throws IOException {
6867
File outputFile = getOutputDirectory().file("failure-report.txt").get().getAsFile();
6968
outputFile.getParentFile().mkdirs();
7069
if (result.hasViolation()) {
71-
Files.write(outputFile.toPath(), result.getFailureReport().toString().getBytes(StandardCharsets.UTF_8),
72-
StandardOpenOption.CREATE);
70+
Files.writeString(outputFile.toPath(), result.getFailureReport().toString(), StandardOpenOption.CREATE);
7371
FileWriter writer = new FileWriter(outputFile);
7472
FileCopyUtils.copy(result.getFailureReport().toString(), writer);
7573
throw new GradleException("Package tangle check failed. See '" + outputFile + "' for details.");

0 commit comments

Comments
 (0)