Specify charset in constructors of InputStreamReader
ErrorProne reports a warning [1] about implicit use of the platform default charset. [1] http://errorprone.info/bugpattern/DefaultCharset Change-Id: Id661781773ca175b52a17cf4d80c37fad17344a8
This commit is contained in:
parent
9932a88865
commit
ce98c50f38
@ -14,6 +14,8 @@
|
||||
|
||||
package com.google.gerrit.acceptance;
|
||||
|
||||
import static java.nio.charset.StandardCharsets.UTF_8;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
@ -34,7 +36,7 @@ public class HttpResponse {
|
||||
|
||||
public Reader getReader() throws IllegalStateException, IOException {
|
||||
if (reader == null && response.getEntity() != null) {
|
||||
reader = new InputStreamReader(response.getEntity().getContent());
|
||||
reader = new InputStreamReader(response.getEntity().getContent(), UTF_8);
|
||||
}
|
||||
return reader;
|
||||
}
|
||||
|
@ -184,7 +184,7 @@ public class PushCertificateCheckerTest {
|
||||
}
|
||||
|
||||
String cert = payload + new String(bout.toByteArray(), UTF_8);
|
||||
Reader reader = new InputStreamReader(new ByteArrayInputStream(cert.getBytes(UTF_8)));
|
||||
Reader reader = new InputStreamReader(new ByteArrayInputStream(cert.getBytes(UTF_8)), UTF_8);
|
||||
PushCertificateParser parser = new PushCertificateParser(repo, signedPushConfig);
|
||||
return parser.parse(reader);
|
||||
}
|
||||
|
@ -16,6 +16,7 @@ package com.google.gerrit.server.mail.send;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
import static com.google.common.truth.Truth.assert_;
|
||||
import static java.nio.charset.StandardCharsets.UTF_8;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.InputStream;
|
||||
@ -36,7 +37,7 @@ public class ValidatorTest {
|
||||
if (in == null) {
|
||||
throw new Exception("TLD list not found");
|
||||
}
|
||||
BufferedReader r = new BufferedReader(new InputStreamReader(in));
|
||||
BufferedReader r = new BufferedReader(new InputStreamReader(in, UTF_8));
|
||||
String tld;
|
||||
while ((tld = r.readLine()) != null) {
|
||||
if (tld.startsWith("# ") || tld.startsWith("XN--")) {
|
||||
|
Loading…
Reference in New Issue
Block a user