13
13
import java .nio .file .Path ;
14
14
import java .security .MessageDigest ;
15
15
import java .security .NoSuchAlgorithmException ;
16
+ import java .util .ArrayList ;
16
17
import java .util .HashMap ;
17
- import java .util .LinkedList ;
18
18
import java .util .List ;
19
19
import java .util .Locale ;
20
20
import java .util .Map ;
@@ -54,6 +54,7 @@ public static final int ExitServerCodeWhenVersionMismatch() {
54
54
* This method takes into account these differences and is compatible with
55
55
* both JDK versions before 22 and later.
56
56
*/
57
+ @ SuppressWarnings ("SystemConsoleNull" )
57
58
public static boolean hasConsole () {
58
59
Console console = System .console ();
59
60
@@ -143,7 +144,7 @@ public static int readInt(InputStream in) throws IOException {
143
144
}
144
145
145
146
/**
146
- * @return Hex encoded MD5 hash of input string.
147
+ * Returns hex encoded MD5 hash of input string.
147
148
*/
148
149
public static String md5hex (String str ) throws NoSuchAlgorithmException {
149
150
return hexArray (MessageDigest .getInstance ("md5" ).digest (str .getBytes (StandardCharsets .UTF_8 )));
@@ -168,8 +169,8 @@ public static String sha1Hash(String path) throws NoSuchAlgorithmException {
168
169
* @return The non-empty lines of the files or an empty list, if the file does not exist
169
170
*/
170
171
public static List <String > readOptsFileLines (final Path file ) throws Exception {
171
- final List <String > vmOptions = new LinkedList <>();
172
- try (final Scanner sc = new Scanner (file .toFile ())) {
172
+ final List <String > vmOptions = new ArrayList <>();
173
+ try (final Scanner sc = new Scanner (file .toFile (), StandardCharsets . UTF_8 )) {
173
174
final Map <String , String > env = System .getenv ();
174
175
while (sc .hasNextLine ()) {
175
176
String arg = sc .nextLine ();
0 commit comments