Skip to content

Commit

Permalink
migrate remaining old guava charset to jdk's (#1382)
Browse files Browse the repository at this point in the history
followup to pr #1381
  • Loading branch information
jzacsh authored Aug 23, 2024
1 parent e79e6c1 commit b92d331
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import com.google.api.client.http.HttpRequestFactory;
import com.google.api.client.http.HttpResponse;
import com.google.api.client.http.HttpTransport;
import com.google.common.base.Charsets;
import com.google.common.base.Joiner;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
Expand All @@ -41,6 +40,7 @@
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.Collection;
import java.util.Map;

Expand Down Expand Up @@ -140,7 +140,7 @@ private String makePostRequest(String url, Map<String, String> params) throws IO
"Bad status code: " + statusCode + " error: " + response.getStatusMessage());
}
String result =
CharStreams.toString(new InputStreamReader(response.getContent(), Charsets.UTF_8));
CharStreams.toString(new InputStreamReader(response.getContent(), StandardCharsets.UTF_8));
return result;
}

Expand All @@ -158,7 +158,7 @@ private <T> T makeRequest(String url, Class<T> clazz)
"Bad status code: " + statusCode + " error: " + response.getStatusMessage());
}
String result =
CharStreams.toString(new InputStreamReader(response.getContent(), Charsets.UTF_8));
CharStreams.toString(new InputStreamReader(response.getContent(), StandardCharsets.UTF_8));
return MAPPER.readValue(result, clazz);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
import com.google.auth.oauth2.AccessToken;
import com.google.auth.oauth2.UserCredentials;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Charsets;
import com.google.common.base.Preconditions;
import com.google.common.base.Strings;
import com.google.common.collect.ArrayListMultimap;
Expand All @@ -65,6 +64,7 @@
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.RandomAccessFile;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
Expand Down Expand Up @@ -185,7 +185,7 @@ <T> T makePostRequest(
"Bad status code: " + statusCode + " error: " + response.getStatusMessage());
}
String result =
CharStreams.toString(new InputStreamReader(response.getContent(), Charsets.UTF_8));
CharStreams.toString(new InputStreamReader(response.getContent(), StandardCharsets.UTF_8));
if (clazz.isAssignableFrom(String.class)) {
return (T) result;
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@
import static org.mockito.Mockito.spy;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.common.base.Charsets;
import com.google.common.io.Resources;
import com.squareup.okhttp.mockwebserver.MockResponse;
import com.squareup.okhttp.mockwebserver.MockWebServer;
import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.util.Optional;
import java.util.UUID;
import okhttp3.OkHttpClient;
Expand Down Expand Up @@ -89,15 +89,15 @@ public class ImgurPhotoExporterTest {
{
try {
albumsResponse =
Resources.toString(Resources.getResource("albums.json"), Charsets.UTF_8).trim();
Resources.toString(Resources.getResource("albums.json"), StandardCharsets.UTF_8).trim();
album1ImagesResponse =
Resources.toString(Resources.getResource("album_1_images.json"), Charsets.UTF_8).trim();
Resources.toString(Resources.getResource("album_1_images.json"), StandardCharsets.UTF_8).trim();
allImagesResponse =
Resources.toString(Resources.getResource("all_images.json"), Charsets.UTF_8).trim();
Resources.toString(Resources.getResource("all_images.json"), StandardCharsets.UTF_8).trim();
page1Response =
Resources.toString(Resources.getResource("page1.json"), Charsets.UTF_8).trim();
Resources.toString(Resources.getResource("page1.json"), StandardCharsets.UTF_8).trim();
page2Response =
Resources.toString(Resources.getResource("page2.json"), Charsets.UTF_8).trim();
Resources.toString(Resources.getResource("page2.json"), StandardCharsets.UTF_8).trim();
} catch (IOException e) {
e.printStackTrace();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import com.google.api.client.http.HttpRequestFactory;
import com.google.api.client.http.HttpResponse;
import com.google.api.client.http.HttpTransport;
import com.google.common.base.Charsets;
import com.google.common.base.Preconditions;
import com.google.common.io.CharStreams;
import org.datatransferproject.spi.transfer.provider.ExportResult;
Expand All @@ -38,6 +37,7 @@

import java.io.IOException;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
Expand Down Expand Up @@ -119,7 +119,7 @@ private <T> T makeRequest(String url, Class<T> clazz, TokensAndUrlAuthData authD
"Bad status code: " + statusCode + " error: " + response.getStatusMessage());
}
String result =
CharStreams.toString(new InputStreamReader(response.getContent(), Charsets.UTF_8));
CharStreams.toString(new InputStreamReader(response.getContent(), StandardCharsets.UTF_8));
return objectMapper.readValue(result, clazz);
}
}

0 comments on commit b92d331

Please sign in to comment.