mirror of
https://github.com/signalapp/Signal-Android.git
synced 2025-12-27 06:29:54 +00: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.InputStream;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Objects;
|
||||
|
||||
import okhttp3.MediaType;
|
||||
import okhttp3.ResponseBody;
|
||||
|
||||
import static okhttp3.internal.Util.UTF_8;
|
||||
|
||||
public final class OkHttpUtil {
|
||||
|
||||
private OkHttpUtil() {}
|
||||
@@ -42,7 +41,7 @@ public final class OkHttpUtil {
|
||||
|
||||
byte[] data = readAsBytes(body.byteStream(), sizeLimit);
|
||||
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));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user