summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuca Milanesio <luca.milanesio@gmail.com>2022-02-03 01:20:19 +0000
committerMatthias Sohn <matthias.sohn@sap.com>2022-02-04 00:29:17 +0100
commitd0553759a0cc3fa0e6a727bf817b5376cc79c971 (patch)
treed728072e9683865176ab677213730c1d45628b62
parent20bdcf9ea82c390ee70180c3edb51888e7d237bc (diff)
downloadjgit-d0553759a0cc3fa0e6a727bf817b5376cc79c971.tar.gz
jgit-d0553759a0cc3fa0e6a727bf817b5376cc79c971.zip
[errorprone] Fix DefaultCharset warning in BareSuperprojectWriterTest
Set the string encoding when converting a byte array into String, avoiding the build-time warning on platform-dependent encoding. See https://errorprone.info/bugpattern/DefaultCharset Change-Id: I1f920043a8f303da43a8278793c38453e8773d69
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/gitrepo/BareSuperprojectWriterTest.java4
1 files changed, 3 insertions, 1 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/gitrepo/BareSuperprojectWriterTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/gitrepo/BareSuperprojectWriterTest.java
index 17fc8db35e..c3b93879b2 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/gitrepo/BareSuperprojectWriterTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/gitrepo/BareSuperprojectWriterTest.java
@@ -15,6 +15,7 @@ import static org.hamcrest.Matchers.is;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
+import java.nio.charset.StandardCharsets;
import java.util.Arrays;
import java.util.List;
@@ -97,7 +98,8 @@ public class BareSuperprojectWriterTest extends RepositoryTestCase {
ObjectId modId = repo.resolve(idStr);
try (ObjectReader reader = repo.newObjectReader()) {
return new String(
- reader.open(modId).getCachedBytes(Integer.MAX_VALUE));
+ reader.open(modId).getCachedBytes(Integer.MAX_VALUE),
+ StandardCharsets.UTF_8);
}
}