Commit a67a4713 authored by Karsten Loesing's avatar Karsten Loesing
Browse files

Resume previously aborted downloads.

So far, whenever DescriptorCollector fetches a remote file, it writes
its contents to a local temporary file and later renames that file.
The idea is to avoid incomplete downloads. However, if a local
temporary file already exists from an earlier run, DescriptorCollector
fails and skips the remote file. This is not intended.

With this change, DescriptorCollector always overwrites a local
temporary file when it finds one. It still doesn't delete incomplete
temporary files that are not re-attempted later. But not skipping them
is already a good start.

Fixes #24153.
parent d1f9a329
......@@ -6,6 +6,9 @@
after upgrading from Java 8 to 9. Applications must provide
Apache Commons Codec 1.10 as dependency.
* Minor changes
- Make DescriptorCollector resume previously aborted downloads.
# Changes in version 2.4.0 - 2018-05-23
......@@ -16,6 +16,7 @@ import java.nio.file.FileVisitResult;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.SimpleFileVisitor;
import java.nio.file.StandardCopyOption;
import java.nio.file.attribute.BasicFileAttributes;
import java.util.Map;
import java.util.SortedMap;
......@@ -120,7 +121,8 @@ public class DescriptorIndexCollector implements DescriptorCollector {
try (InputStream is = new URL(baseUrl + "/" + filepathname)
.openStream()) {
Files.copy(is, tempDestinationFile.toPath());
Files.copy(is, tempDestinationFile.toPath(),
if (tempDestinationFile.length() == entry.getValue().size) {
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment