Migrate from the deprecated Charsets to StandardCharsets
Migrate from the deprecated Charsets constants (in Guava) to the
StandardCharsets constants (in the JDK).
These changes have been applied internally at Google (cl/658685362), but
they may get overridden on the next import.
Change-Id: Ib5e403ddeaf5755295c19a9e82dd64bed9b820ef
Signed-off-by: Edwin Kempin <ekempin@google.com>
diff --git a/src/test/java/com/googlesource/gerrit/plugins/automerger/ConfigLoaderIT.java b/src/test/java/com/googlesource/gerrit/plugins/automerger/ConfigLoaderIT.java
index 8d43ba5..decd5a9 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/automerger/ConfigLoaderIT.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/automerger/ConfigLoaderIT.java
@@ -17,7 +17,6 @@
import static com.google.common.truth.Truth.assertThat;
import static com.google.gerrit.testing.GerritJUnit.assertThrows;
-import com.google.common.base.Charsets;
import com.google.common.io.CharStreams;
import com.google.gerrit.acceptance.GitUtil;
import com.google.gerrit.acceptance.LightweightPluginDaemonTest;
@@ -35,6 +34,7 @@
import com.google.inject.Provider;
import java.io.InputStream;
import java.io.InputStreamReader;
+import java.nio.charset.StandardCharsets;
import java.util.HashSet;
import java.util.Set;
import org.eclipse.jgit.errors.ConfigInvalidException;
@@ -270,7 +270,8 @@
throws Exception {
TestRepository<InMemoryRepository> repo = cloneProject(projectNameKey, admin);
try (InputStream in = getClass().getResourceAsStream(resourceName)) {
- String resourceString = CharStreams.toString(new InputStreamReader(in, Charsets.UTF_8));
+ String resourceString =
+ CharStreams.toString(new InputStreamReader(in, StandardCharsets.UTF_8));
PushOneCommit push =
pushFactory.create(admin.newIdent(), repo, "some subject", filename, resourceString);
@@ -283,7 +284,8 @@
GitUtil.fetch(allProjectRepo, RefNames.REFS_CONFIG + ":config");
allProjectRepo.reset("config");
try (InputStream in = getClass().getResourceAsStream(resourceName)) {
- String resourceString = CharStreams.toString(new InputStreamReader(in, Charsets.UTF_8));
+ String resourceString =
+ CharStreams.toString(new InputStreamReader(in, StandardCharsets.UTF_8));
Config cfg = new Config();
cfg.fromText(resourceString);
diff --git a/src/test/java/com/googlesource/gerrit/plugins/automerger/DownstreamCreatorIT.java b/src/test/java/com/googlesource/gerrit/plugins/automerger/DownstreamCreatorIT.java
index 1781b3e..254942f 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/automerger/DownstreamCreatorIT.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/automerger/DownstreamCreatorIT.java
@@ -29,7 +29,6 @@
import static com.google.gerrit.testing.GerritJUnit.assertThrows;
import static java.util.Comparator.comparing;
-import com.google.common.base.Charsets;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Iterables;
import com.google.common.io.CharStreams;
@@ -60,6 +59,7 @@
import com.googlesource.gerrit.plugins.automerger.helpers.ConfigOption;
import java.io.InputStream;
import java.io.InputStreamReader;
+import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
@@ -944,7 +944,8 @@
throws Exception {
TestRepository<InMemoryRepository> repo = cloneProject(projectNameKey, admin);
try (InputStream in = getClass().getResourceAsStream(resourceName)) {
- String resourceString = CharStreams.toString(new InputStreamReader(in, Charsets.UTF_8));
+ String resourceString =
+ CharStreams.toString(new InputStreamReader(in, StandardCharsets.UTF_8));
PushOneCommit push =
pushFactory.create(admin.newIdent(), repo, "some subject", filename, resourceString);
@@ -957,7 +958,8 @@
GitUtil.fetch(allProjectRepo, RefNames.REFS_CONFIG + ":config");
allProjectRepo.reset("config");
try (InputStream in = getClass().getResourceAsStream(resourceName)) {
- String resourceString = CharStreams.toString(new InputStreamReader(in, Charsets.UTF_8));
+ String resourceString =
+ CharStreams.toString(new InputStreamReader(in, StandardCharsets.UTF_8));
Config cfg = new Config();
cfg.fromText(resourceString);
diff --git a/src/test/java/com/googlesource/gerrit/plugins/automerger/ManifestReaderTest.java b/src/test/java/com/googlesource/gerrit/plugins/automerger/ManifestReaderTest.java
index 256b798..fd41d8f 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/automerger/ManifestReaderTest.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/automerger/ManifestReaderTest.java
@@ -16,10 +16,10 @@
import static com.google.common.truth.Truth.assertThat;
-import com.google.common.base.Charsets;
import com.google.common.io.CharStreams;
import java.io.InputStream;
import java.io.InputStreamReader;
+import java.nio.charset.StandardCharsets;
import java.util.HashSet;
import java.util.Set;
import org.junit.Before;
@@ -32,7 +32,7 @@
@Before
public void setUp() throws Exception {
try (InputStream in = getClass().getResourceAsStream("default.xml")) {
- manifestString = CharStreams.toString(new InputStreamReader(in, Charsets.UTF_8));
+ manifestString = CharStreams.toString(new InputStreamReader(in, StandardCharsets.UTF_8));
}
manifestReader = new ManifestReader("master", manifestString);
}
diff --git a/src/test/java/com/googlesource/gerrit/plugins/automerger/MergeValidatorIT.java b/src/test/java/com/googlesource/gerrit/plugins/automerger/MergeValidatorIT.java
index 753346e..c5b37ff 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/automerger/MergeValidatorIT.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/automerger/MergeValidatorIT.java
@@ -17,7 +17,6 @@
import static com.google.common.truth.Truth.assertThat;
import static com.google.gerrit.testing.GerritJUnit.assertThrows;
-import com.google.common.base.Charsets;
import com.google.common.io.CharStreams;
import com.google.gerrit.acceptance.GitUtil;
import com.google.gerrit.acceptance.LightweightPluginDaemonTest;
@@ -30,6 +29,7 @@
import com.google.gerrit.extensions.restapi.ResourceConflictException;
import java.io.InputStream;
import java.io.InputStreamReader;
+import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
@@ -48,7 +48,8 @@
GitUtil.fetch(allProjectRepo, RefNames.REFS_CONFIG + ":config");
allProjectRepo.reset("config");
try (InputStream in = getClass().getResourceAsStream(resourceName)) {
- String resourceString = CharStreams.toString(new InputStreamReader(in, Charsets.UTF_8));
+ String resourceString =
+ CharStreams.toString(new InputStreamReader(in, StandardCharsets.UTF_8));
Config cfg = new Config();
cfg.fromText(resourceString);