diff --git a/buildSrc/src/main/java/org/springframework/boot/build/architecture/PackageTangleCheck.java b/buildSrc/src/main/java/org/springframework/boot/build/architecture/PackageTangleCheck.java index 0c4ceb1a8e..5cca955435 100644 --- a/buildSrc/src/main/java/org/springframework/boot/build/architecture/PackageTangleCheck.java +++ b/buildSrc/src/main/java/org/springframework/boot/build/architecture/PackageTangleCheck.java @@ -1,5 +1,5 @@ /* - * Copyright 2022-2022 the original author or authors. + * Copyright 2022-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,7 +19,6 @@ package org.springframework.boot.build.architecture; import java.io.File; import java.io.FileWriter; import java.io.IOException; -import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.StandardOpenOption; import java.util.stream.Collectors; @@ -68,8 +67,7 @@ public abstract class PackageTangleCheck extends DefaultTask { File outputFile = getOutputDirectory().file("failure-report.txt").get().getAsFile(); outputFile.getParentFile().mkdirs(); if (result.hasViolation()) { - Files.write(outputFile.toPath(), result.getFailureReport().toString().getBytes(StandardCharsets.UTF_8), - StandardOpenOption.CREATE); + Files.writeString(outputFile.toPath(), result.getFailureReport().toString(), StandardOpenOption.CREATE); FileWriter writer = new FileWriter(outputFile); FileCopyUtils.copy(result.getFailureReport().toString(), writer); throw new GradleException("Package tangle check failed. See '" + outputFile + "' for details.");