Fix Can be replaced with 'Files.writeString()' warnings

GitOrigin-RevId: f745ef1ef6928beba973da5bbf9f74193646a9e1
This commit is contained in:
Tagir Valeev
2022-08-12 09:31:12 +00:00
committed by intellij-monorepo-bot
parent 058c748311
commit b1056c285e
4 changed files with 5 additions and 5 deletions
@@ -66,7 +66,7 @@ public class JrtFileSystemTest extends BareTestFixtureTestCase {
private void setupJrtFileSystem() throws IOException {
Files.createDirectories(myJrtPath);
Files.write(myJrtPath.resolve("release"), "JAVA_VERSION=9\n".getBytes(StandardCharsets.UTF_8));
Files.writeString(myJrtPath.resolve("release"), "JAVA_VERSION=9\n");
Path lib = Files.createDirectory(myJrtPath.resolve("lib"));
Files.copy(myTestData.resolve("jrt-fs.jar"), lib.resolve("jrt-fs.jar"));
Files.copy(myTestData.resolve("image1"), lib.resolve("modules"));
@@ -111,7 +111,7 @@ public class JrtFileSystemTest extends BareTestFixtureTestCase {
Path modules = myJrtPath.resolve("lib/modules");
Files.move(modules, myJrtPath.resolve("lib/modules.bak"), StandardCopyOption.ATOMIC_MOVE);
Files.copy(myTestData.resolve("image2"), modules);
Files.write(myJrtPath.resolve("release"), "JAVA_VERSION=9.0.1\n".getBytes(StandardCharsets.UTF_8));
Files.writeString(myJrtPath.resolve("release"), "JAVA_VERSION=9.0.1\n");
List<VFileEvent> events = VfsTestUtil.getEvents(() -> local.refresh(false, true));
assertThat(childNames(myRoot)).describedAs("events=" + events).containsExactlyInAnyOrder("java.base", "test.a", "test.b");
@@ -75,7 +75,7 @@ class LightTestMigration {
FileUtil.delete(myDir.toFile());
Files.createDirectories(myDir);
for (Pair<Path, String> file : resultFiles) {
Files.write(file.getFirst(), file.getSecond().getBytes(StandardCharsets.UTF_8));
Files.writeString(file.getFirst(), file.getSecond());
System.out.println("Written: " + file.getFirst());
}
}
@@ -225,7 +225,7 @@ public class GlobalInspectionContextEx extends GlobalInspectionContextBase {
try {
Path file = InspectionsResultUtil.getInspectionResultPath(outputDir, sameTools.getShortName());
inspectionsResults.add(file);
Files.write(file, ("</" + PROBLEMS_TAG_NAME + ">").getBytes(StandardCharsets.UTF_8), StandardOpenOption.APPEND);
Files.writeString(file, "</" + PROBLEMS_TAG_NAME + ">", StandardOpenOption.APPEND);
}
catch (IOException e) {
LOG.error(e);
@@ -141,7 +141,7 @@ public final class CreateDesktopEntryAction extends DumbAwareAction {
Map<String, String> vars = Map.of("$NAME$", name, "$SCRIPT$", execPath, "$ICON$", iconPath, "$COMMENT$", comment, "$WM_CLASS$", wmClass);
String content = ExecUtil.loadTemplate(CreateDesktopEntryAction.class.getClassLoader(), "entry.desktop", vars);
Path entryFile = Paths.get(PathManager.getTempPath(), wmClass + ".desktop");
Files.write(entryFile, content.getBytes(StandardCharsets.UTF_8));
Files.writeString(entryFile, content);
return entryFile;
}