Skip to content

Commit fef7d1d

Browse files
authored
Merge pull request #258 from scala/backport-lts-3.3-21633
Backport "Remove locale dependent FileSystemException check" to 3.3 LTS
2 parents 28fd23b + 9bff673 commit fef7d1d

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

compiler/src/dotty/tools/dotc/util/SourceFile.scala

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -275,12 +275,11 @@ object SourceFile {
275275

276276
def apply(file: AbstractFile | Null, codec: Codec): SourceFile =
277277
// Files.exists is slow on Java 8 (https://rules.sonarsource.com/java/tag/performance/RSPEC-3725),
278-
// so cope with failure; also deal with path prefix "Not a directory".
278+
// so cope with failure.
279279
val chars =
280280
try new String(file.toByteArray, codec.charSet).toCharArray
281281
catch
282-
case _: NoSuchFileException => Array.empty[Char]
283-
case fse: FileSystemException if fse.getMessage.endsWith("Not a directory") => Array.empty[Char]
282+
case _: FileSystemException => Array.empty[Char]
284283

285284
if isScript(file, chars) then
286285
ScriptSourceFile(file, chars)

0 commit comments

Comments
 (0)