Skip to content

Commit

Permalink
Merge pull request #159 from mreutegg/httpclient5
Browse files Browse the repository at this point in the history
Update to httpclient5
  • Loading branch information
mreutegg authored Jan 19, 2025
2 parents e98cc1d + c604352 commit a65e3d4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,9 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.14</version>
<groupId>org.apache.httpcomponents.client5</groupId>
<artifactId>httpclient5</artifactId>
<version>5.4.1</version>
<scope>test</scope>
</dependency>
<dependency>
Expand Down
12 changes: 6 additions & 6 deletions src/test/java/com/github/mreutegg/laszip4j/DataFiles.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,9 @@
*/
package com.github.mreutegg.laszip4j;

import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.hc.client5.http.classic.methods.HttpGet;
import org.apache.hc.client5.http.impl.classic.CloseableHttpClient;
import org.apache.hc.client5.http.impl.classic.HttpClients;
import org.junit.rules.ExternalResource;

import java.io.File;
Expand Down Expand Up @@ -80,11 +79,12 @@ public void download() throws Exception {
private static void download(String uri, File file) throws Exception {
URI url = new URI(uri);
try (CloseableHttpClient client = HttpClients.createDefault()) {
try (CloseableHttpResponse response = client.execute(new HttpGet(url))) {
client.execute(new HttpGet(url), response -> {
try (OutputStream out = Files.newOutputStream(file.toPath())) {
response.getEntity().writeTo(out);
}
}
return true;
});
}
}
}

0 comments on commit a65e3d4

Please sign in to comment.