[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
This commit is contained in:
parent
20bdcf9ea8
commit
d0553759a0
|
@ -15,6 +15,7 @@
|
|||
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 @@ private String readContents(Repository repo, RevCommit commit,
|
|||
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);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue