]> source.dussan.org Git - jgit.git/commitdiff
[errorprone] Fix implicit use of default charset in FileBasedConfigTest 73/189573/2
authorMatthias Sohn <matthias.sohn@sap.com>
Wed, 12 Jan 2022 01:02:35 +0000 (02:02 +0100)
committerMatthias Sohn <matthias.sohn@sap.com>
Tue, 18 Jan 2022 15:11:56 +0000 (16:11 +0100)
Change-Id: I83332efc498a5bce242915a1eec2346e6e1f58fd

org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/FileBasedConfigTest.java

index 7f0bfefbe7ba9637b80feaab27806761c9917f96..b964e97752f0a1e0be08bbdc05557d869e8a89a1 100644 (file)
@@ -19,6 +19,7 @@ import static org.junit.Assert.assertFalse;
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 import java.io.OutputStream;
+import java.nio.charset.StandardCharsets;
 import java.nio.file.Files;
 import java.nio.file.Path;
 import java.nio.file.StandardOpenOption;
@@ -276,7 +277,8 @@ public class FileBasedConfigTest {
                        throws IOException {
                AtomicBoolean userConfigTimeRead = new AtomicBoolean(false);
 
-               Path userConfigFile = createFile(CONTENT1.getBytes(), "home");
+               Path userConfigFile = createFile(
+                               CONTENT1.getBytes(StandardCharsets.UTF_8), "home");
                mockSystemReader.setUserGitConfig(
                                new FileBasedConfig(userConfigFile.toFile(), FS.DETECTED) {
 
@@ -289,7 +291,8 @@ public class FileBasedConfigTest {
                                        }
                                });
 
-               Path file = createFile(CONTENT2.getBytes(), "repo");
+               Path file = createFile(CONTENT2.getBytes(StandardCharsets.UTF_8),
+                               "repo");
                FileBasedConfig fileBasedConfig = new FileBasedConfig(file.toFile(),
                                FS.DETECTED);
                fileBasedConfig.save();