[
https://issues.apache.org/jira/browse/MRESOLVER-282?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17627618#comment-17627618
]
ASF GitHub Bot commented on MRESOLVER-282:
------------------------------------------
michael-o commented on code in PR #212:
URL: https://github.com/apache/maven-resolver/pull/212#discussion_r1011588336
##########
maven-resolver-transport-http/src/main/java/org/eclipse/aether/transport/http/HttpTransporter.java:
##########
@@ -592,16 +594,25 @@ public void handle( HttpResponse response )
if ( offset < 0L || offset >= length || ( offset > 0L &&
offset != task.getResumeOffset() ) )
{
throw new IOException( "Invalid Content-Range header for
partial download from offset "
- + task.getResumeOffset() + ": " + range );
+ + task.getResumeOffset() + ": " + range );
}
}
- InputStream is = entity.getContent();
- utilGet( task, is, true, length, offset > 0L );
- extractChecksums( response );
+ try ( FileUtils.TempFile tempFile = FileUtils.newTempFile() )
+ {
+ try ( InputStream is = entity.getContent() )
+ {
+ Files.copy( is, tempFile.getPath(),
StandardCopyOption.REPLACE_EXISTING );
+ }
+ try ( InputStream is = Files.newInputStream(
tempFile.getPath() ) )
+ {
Review Comment:
Note that you would rather use
https://www.javadoc.io/doc/org.apache.httpcomponents/httpcore/4.4.4/org/apache/http/HttpEntity.html#writeTo(java.io.OutputStream)..
> Drop PartialFile
> ----------------
>
> Key: MRESOLVER-282
> URL: https://issues.apache.org/jira/browse/MRESOLVER-282
> Project: Maven Resolver
> Issue Type: Task
> Components: Resolver
> Reporter: Tamas Cservenak
> Priority: Major
> Fix For: 1.9.0
>
>
> Drop {{PartialFile}} that may cause locking issues, the drawback is to loose
> "resumable downloads".
> Also, clear up the temp file usage around it, and simplify resource handling.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)