8214514: javac @file option gives error caused by Chinese encoding in the path
Reviewed-by: jjg
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/main/CommandLine.java Thu Dec 06 13:54:52 2018 -0500
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/main/CommandLine.java Thu Dec 06 15:51:19 2018 -0500
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,7 @@
import java.io.IOException;
import java.io.Reader;
+import java.nio.charset.Charset;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.ArrayList;
@@ -125,7 +126,7 @@
}
private static void loadCmdFile(String name, List<String> args) throws IOException {
- try (Reader r = Files.newBufferedReader(Paths.get(name))) {
+ try (Reader r = Files.newBufferedReader(Paths.get(name), Charset.defaultCharset())) {
Tokenizer t = new Tokenizer(r);
String s;
while ((s = t.nextToken()) != null) {