more robust: prefer strict operations;
authorwenzelm
Sun, 12 Nov 2023 12:34:04 +0100
changeset 78958 c125f75a5144
parent 78957 932b2a7139e2
child 78959 78698a97afb3
more robust: prefer strict operations;
src/Pure/General/mailman.scala
src/Pure/ML/ml_heap.scala
src/Pure/Tools/profiling.scala
--- a/src/Pure/General/mailman.scala	Sun Nov 12 12:33:22 2023 +0100
+++ b/src/Pure/General/mailman.scala	Sun Nov 12 12:34:04 2023 +0100
@@ -376,15 +376,14 @@
       try {
         val length = connection.getContentLengthLong
         val timestamp = connection.getLastModified
-        val file = path.file
-        if (file.isFile && file.length == length && file.lastModified == timestamp) None
+        if (path.is_file && File.size(path) == length && path.file.lastModified == timestamp) None
         else {
           Isabelle_System.make_directory(path.dir)
           progress.echo("Getting " + url)
           val bytes =
             using(connection.getInputStream)(Bytes.read_stream(_, hint = length.toInt max 1024))
-          Bytes.write(file, bytes)
-          file.setLastModified(timestamp)
+          Bytes.write(path, bytes)
+          path.file.setLastModified(timestamp)
           Some(path)
         }
       }
--- a/src/Pure/ML/ml_heap.scala	Sun Nov 12 12:33:22 2023 +0100
+++ b/src/Pure/ML/ml_heap.scala	Sun Nov 12 12:34:04 2023 +0100
@@ -21,7 +21,7 @@
     if (heap.is_file) {
       val l = sha1_prefix.length
       val m = l + SHA1.digest_length
-      val n = heap.file.length
+      val n = File.size(heap)
       val bs = Bytes.read_file(heap, offset = n - m)
       if (bs.length == m) {
         val s = bs.text
--- a/src/Pure/Tools/profiling.scala	Sun Nov 12 12:33:22 2023 +0100
+++ b/src/Pure/Tools/profiling.scala	Sun Nov 12 12:34:04 2023 +0100
@@ -97,7 +97,7 @@
         locales = session.locales,
         locale_thms = session.locale_thms,
         global_thms = session.global_thms,
-        heap_size = Space.bytes(store.the_heap(session_name).file.length),
+        heap_size = File.space(store.the_heap(session_name)),
         thys_id_size = session.sizeof_thys_id,
         thms_id_size = session.sizeof_thms_id,
         terms_size = session.sizeof_terms,