Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use better URI method #333

Merged
merged 1 commit into from
Oct 16, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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