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:
David Pursehouse
2015-10-08 15:46:47 +09:00
parent 852022af90
commit 19c63fa311
49 changed files with 170 additions and 148 deletions

View File

@@ -14,6 +14,8 @@
package com.google.gerrit.server.util;
import static java.nio.charset.StandardCharsets.UTF_8;
import com.google.common.base.Strings;
import com.google.gerrit.common.Die;
import com.google.gerrit.server.config.GerritServerConfig;
@@ -60,7 +62,7 @@ public class SystemLog {
final DailyRollingFileAppender dst = new DailyRollingFileAppender();
dst.setName(name);
dst.setLayout(layout);
dst.setEncoding("UTF-8");
dst.setEncoding(UTF_8.name());
dst.setFile(resolve(logdir).resolve(name).toString());
dst.setImmediateFlush(true);
dst.setAppend(true);