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

@@ -12,6 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.
import static java.nio.charset.StandardCharsets.UTF_8;
import com.google.gerrit.server.documentation.Constants;
import org.apache.lucene.analysis.standard.StandardAnalyzer;
@@ -108,7 +110,7 @@ public class DocIndexer {
String title;
try (BufferedReader titleReader = new BufferedReader(
new InputStreamReader(new FileInputStream(file), "UTF-8"))) {
new InputStreamReader(new FileInputStream(file), UTF_8))) {
title = titleReader.readLine();
if (title != null && title.startsWith("[[")) {
// Generally the first line of the txt is the title. In a few cases the