@@ -2,10 +2,11 @@ package dotty
22package tools
33package vulpix
44
5- import java .io .{File => JFile }
5+ import java .io .{File => JFile , IOException }
66import java .lang .System .{lineSeparator => EOL }
77import java .nio .file .StandardCopyOption .REPLACE_EXISTING
88import java .nio .file .{Files , NoSuchFileException , Path , Paths }
9+ import java .nio .charset .StandardCharsets
910import java .text .SimpleDateFormat
1011import java .util .{HashMap , Timer , TimerTask }
1112import java .util .concurrent .{TimeUnit , TimeoutException , Executors => JExecutors }
@@ -451,7 +452,7 @@ trait ParallelTesting extends RunnerOrchestration { self =>
451452 def compileWithJavac (fs : Array [String ]) = if (fs.nonEmpty) {
452453 val fullArgs = Array (
453454 " javac" ,
454- " -encoding" , " UTF-8 " ,
455+ " -encoding" , StandardCharsets . UTF_8 .name ,
455456 ) ++ flags.javacFlags ++ fs
456457
457458 val process = Runtime .getRuntime.exec(fullArgs)
@@ -607,9 +608,11 @@ trait ParallelTesting extends RunnerOrchestration { self =>
607608 if checkFiles.contains(file) then
608609 val checkFile = checkFiles(file)
609610 val actual = {
610- val source = Source .fromFile(file, " UTF-8 " )
611+ val source = Source .fromFile(file, StandardCharsets . UTF_8 .name )
611612 val lines = source.getLines().toList
612- source.close()
613+ try source.close()
614+ catch
615+ case _ : IOException => // ignore file close errors
613616 lines
614617 }
615618 diffTest(testSource, checkFile, actual, reporters, logger)
@@ -695,7 +698,7 @@ trait ParallelTesting extends RunnerOrchestration { self =>
695698 val errorMap = new HashMap [String , Integer ]()
696699 var expectedErrors = 0
697700 files.filter(isSourceFile).foreach { file =>
698- Using (Source .fromFile(file, " UTF-8 " )) { source =>
701+ Using (Source .fromFile(file, StandardCharsets . UTF_8 .name )) { source =>
699702 source.getLines.zipWithIndex.foreach { case (line, lineNbr) =>
700703 val errors = line.toSeq.sliding(" // error" .length).count(_.unwrap == " // error" )
701704 if (errors > 0 )
0 commit comments