Consistently use character encoding constants
Use the java.nio.charset.StandardCharsets.{ISO_8859_1,UTF_8} constants'
name() methods instead of hard-coding the strings.
Where possible, use method variants that take a Charset rather than
a String. This removes the need to catch UnsupportedEncodingException
in some cases.
Change-Id: I4ac1ba0a753de715e1f38ce631842f527b9e127c
This commit is contained in:
@@ -14,6 +14,7 @@
|
||||
|
||||
package com.google.gerrit.server.documentation;
|
||||
|
||||
import static java.nio.charset.StandardCharsets.UTF_8;
|
||||
import static org.pegdown.Extensions.ALL;
|
||||
import static org.pegdown.Extensions.HARDWRAPS;
|
||||
import static org.pegdown.Extensions.SUPPRESS_ALL_HTML;
|
||||
@@ -159,7 +160,7 @@ public class MarkdownFormatter {
|
||||
try (InputStream in = url.openStream();
|
||||
TemporaryBuffer.Heap tmp = new TemporaryBuffer.Heap(128 * 1024)) {
|
||||
tmp.copy(in);
|
||||
return new String(tmp.toByteArray(), "UTF-8");
|
||||
return new String(tmp.toByteArray(), UTF_8);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user