Skip to content

Commit

Permalink
use better URI method (#333)
Browse files Browse the repository at this point in the history
  • Loading branch information
mrbusche authored Oct 16, 2023
1 parent 543d2ce commit 20640cd
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/main/java/trap/report/DownloadHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import java.io.File;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
Expand All @@ -16,7 +15,7 @@

public class DownloadHelper {

public void downloadFiles(String[] trapTypes) throws IOException, URISyntaxException {
public void downloadFiles(String[] trapTypes) throws IOException {
long start = System.currentTimeMillis();
System.out.println("Started downloading files");

Expand All @@ -25,7 +24,7 @@ public void downloadFiles(String[] trapTypes) throws IOException, URISyntaxExcep
Charset charset = StandardCharsets.UTF_8;
for (String type : trapTypes) {
System.out.println("Downloading " + type + " file");
copyURLToFile(new URI(fileUrls.get(type)).toURL(), new File(type + ".csv"), 120000, 120000);
copyURLToFile(URI.create(fileUrls.get(type)).toURL(), new File(type + ".csv"), 120000, 120000);
System.out.println("Finished downloading " + type + " file");

System.out.println("Replacing double spaces for " + type + " file");
Expand Down

0 comments on commit 20640cd

Please sign in to comment.