--- a/src/Pure/General/file.scala Thu Nov 23 11:40:49 2023 +0100
+++ b/src/Pure/General/file.scala Fri Nov 24 11:10:31 2023 +0100
@@ -13,7 +13,7 @@
import java.nio.file.{StandardOpenOption, Path => JPath, Files, SimpleFileVisitor,
FileVisitOption, FileVisitResult}
import java.nio.file.attribute.{BasicFileAttributes, PosixFilePermission}
-import java.net.{URI, URL, MalformedURLException, URISyntaxException}
+import java.net.{URI, URL}
import java.util.zip.{GZIPInputStream, GZIPOutputStream}
import java.util.EnumSet
@@ -41,9 +41,7 @@
}
else name
}
- catch {
- case _: MalformedURLException | _: URISyntaxException => standard_path(name)
- }
+ catch { case exn: Throwable if Url.is_malformed(exn) => standard_path(name) }
/* platform path (Windows or Posix) */
--- a/src/Pure/General/url.scala Thu Nov 23 11:40:49 2023 +0100
+++ b/src/Pure/General/url.scala Fri Nov 24 11:10:31 2023 +0100
@@ -31,11 +31,15 @@
/* make and check URLs */
+ def is_malformed(exn: Throwable): Boolean =
+ exn.isInstanceOf[MalformedURLException] ||
+ exn.isInstanceOf[URISyntaxException] ||
+ exn.isInstanceOf[IllegalArgumentException]
+
def apply(name: String): URL =
try { new URI(name).toURL }
catch {
- case _: MalformedURLException | _: URISyntaxException =>
- error("Malformed URL " + quote(name))
+ case exn: Throwable if is_malformed(exn) => error("Malformed URL " + quote(name))
}
def resolve(url: URL, route: String): URL =