mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-24 10:51:27 +01:00
Use StandardCharsets in OkHttpUtil.
okhttp3.internal.Util.UTF_8 was never meant to be used outside of okhttp3 library; and it has been deleted in later versions. Signal should use java.nio.charset.StandardCharsets instead. No functional change. Closes #12413
This commit is contained in:
committed by
Greyson Parrelli
parent
13f3a8cf8a
commit
b92dd19a4c
@@ -6,13 +6,12 @@ import java.io.ByteArrayOutputStream;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.nio.charset.Charset;
|
import java.nio.charset.Charset;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
import okhttp3.MediaType;
|
import okhttp3.MediaType;
|
||||||
import okhttp3.ResponseBody;
|
import okhttp3.ResponseBody;
|
||||||
|
|
||||||
import static okhttp3.internal.Util.UTF_8;
|
|
||||||
|
|
||||||
public final class OkHttpUtil {
|
public final class OkHttpUtil {
|
||||||
|
|
||||||
private OkHttpUtil() {}
|
private OkHttpUtil() {}
|
||||||
@@ -42,7 +41,7 @@ public final class OkHttpUtil {
|
|||||||
|
|
||||||
byte[] data = readAsBytes(body.byteStream(), sizeLimit);
|
byte[] data = readAsBytes(body.byteStream(), sizeLimit);
|
||||||
MediaType contentType = body.contentType();
|
MediaType contentType = body.contentType();
|
||||||
Charset charset = contentType != null ? contentType.charset(UTF_8) : UTF_8;
|
Charset charset = contentType != null ? contentType.charset(StandardCharsets.UTF_8) : StandardCharsets.UTF_8;
|
||||||
|
|
||||||
return new String(data, Objects.requireNonNull(charset));
|
return new String(data, Objects.requireNonNull(charset));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user