Skip to content

Commit 7f2cfc0

Browse files
committed
chore(release): address PR review comments on ReleaseNoteGeneration
1 parent 0bae71c commit 7f2cfc0

1 file changed

Lines changed: 6 additions & 8 deletions

File tree

java-cloud-bom/release-note-generation/src/main/java/com/google/cloud/ReleaseNoteGeneration.java

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,11 @@
3434
import com.google.common.collect.Sets;
3535
import com.google.common.collect.Sets.SetView;
3636
import com.google.common.collect.Streams;
37-
import com.google.common.io.Files;
3837
import java.io.File;
3938
import java.io.IOException;
39+
import java.nio.charset.StandardCharsets;
40+
import java.nio.file.Files;
41+
import java.nio.file.Path;
4042
import java.util.ArrayList;
4143
import java.util.HashMap;
4244
import java.util.List;
@@ -46,7 +48,6 @@
4648
import java.util.concurrent.TimeUnit;
4749
import java.util.regex.Matcher;
4850
import java.util.regex.Pattern;
49-
import org.apache.commons.codec.Charsets;
5051
import org.eclipse.aether.RepositorySystem;
5152
import org.eclipse.aether.artifact.Artifact;
5253
import org.eclipse.aether.artifact.DefaultArtifact;
@@ -108,7 +109,7 @@ public static void main(String[] arguments)
108109
ReleaseNoteGeneration generation = new ReleaseNoteGeneration();
109110
String report = generation.generateReport(bom, googleCloudJavaVersion);
110111

111-
Files.asCharSink(new File(RELEASE_NOTE_FILE_NAME), Charsets.UTF_8).write(report);
112+
Files.writeString(Path.of(RELEASE_NOTE_FILE_NAME), report);
112113
System.out.println("Wrote " + RELEASE_NOTE_FILE_NAME);
113114
}
114115

@@ -645,7 +646,7 @@ static String fetchReleaseNote(String owner, String repository, String tag)
645646
throws IOException, InterruptedException {
646647
// gh release --repo googleapis/java-storage view v2.16.0
647648

648-
File tempFile = java.nio.file.Files.createTempFile("gh-release-notes", ".txt").toFile();
649+
File tempFile = Files.createTempFile("gh-release-notes", ".txt").toFile();
649650
tempFile.deleteOnExit();
650651

651652
Process process = null;
@@ -661,10 +662,7 @@ static String fetchReleaseNote(String owner, String repository, String tag)
661662
throw new IOException("The process timed out");
662663
}
663664

664-
String output =
665-
new String(
666-
java.nio.file.Files.readAllBytes(tempFile.toPath()),
667-
java.nio.charset.StandardCharsets.UTF_8);
665+
String output = new String(Files.readAllBytes(tempFile.toPath()), StandardCharsets.UTF_8);
668666

669667
if (process.exitValue() != 0) {
670668
String trimmedOutput = output.trim();

0 commit comments

Comments
 (0)