Skip to content

Commit

Permalink
fix modernizer waarschuwingen in bgt-loader module
Browse files Browse the repository at this point in the history
  • Loading branch information
mprins committed Jan 20, 2025
1 parent f3f7bb9 commit 48c8aca
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
5 changes: 5 additions & 0 deletions bgt-loader/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,11 @@ SPDX-License-Identifier: MIT
<groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId>
</dependency>
<dependency>
<groupId>org.gaul</groupId>
<artifactId>modernizer-maven-annotations</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
import java.io.FileInputStream;
import java.io.InputStream;
import java.net.URI;
import java.nio.file.Files;
import java.nio.file.Path;
import java.sql.SQLException;
import java.time.Instant;
import java.util.ArrayList;
Expand Down Expand Up @@ -153,9 +155,9 @@ public int load(
if (file.endsWith(".zip") && (file.startsWith("http://") || file.startsWith("https://"))) {
loadZipFromURI(new URI(file), writer, featureTypeSelectionOptions, loadOptions, true);
} else if (file.endsWith(".zip")) {
loadZip(new File(file), writer, featureTypeSelectionOptions);
loadZip(Path.of(file).toFile(), writer, featureTypeSelectionOptions);
} else if (file.matches(".*\\.[xg]ml")) {
loadXml(new File(file), writer);
loadXml(Path.of(file).toFile(), writer);
} else {
log.error(getMessageFormattedString("load.invalid_extension", file));
return ExitCode.USAGE;
Expand Down Expand Up @@ -396,7 +398,7 @@ public void loadZip(
}

public void loadXml(File file, BGTObjectTableWriter writer) throws Exception {
try (FileInputStream in = new FileInputStream(file)) {
try (FileInputStream in = (FileInputStream) Files.newInputStream(file.toPath())) {
loadInputStream(file.getName(), in, file.length(), writer);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import org.gaul.modernizer_maven_annotations.SuppressModernizer;

public class BGTTestFiles {
public static InputStream getTestInputStream(String name) {
Expand All @@ -23,6 +24,7 @@ public static InputStream getTestInputStream(String name) {
return input;
}

@SuppressModernizer
public static File getTestFile(String name) {
URL url = BGTTestFiles.class.getResource("/" + name);
assertNotNull(url, name);
Expand Down

0 comments on commit 48c8aca

Please sign in to comment.