Skip to content

Commit

Permalink
fix modernizer waarschuwingen in brmo-loader module
Browse files Browse the repository at this point in the history
  • Loading branch information
mprins committed Jan 20, 2025
1 parent 48c8aca commit f2f8cb1
Show file tree
Hide file tree
Showing 17 changed files with 43 additions and 14 deletions.
4 changes: 4 additions & 0 deletions brmo-loader/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,10 @@
<artifactId>junit-jupiter-params</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.gaul</groupId>
<artifactId>modernizer-maven-annotations</artifactId>
</dependency>
</dependencies>
<build>
<finalName>${project.artifactId}</finalName>
Expand Down
16 changes: 8 additions & 8 deletions brmo-loader/src/main/java/nl/b3p/brmo/loader/BrmoFramework.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
package nl.b3p.brmo.loader;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.math.BigInteger;
import java.nio.file.Files;
import java.nio.file.Path;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.Date;
Expand Down Expand Up @@ -367,12 +368,12 @@ public void loadFromFile(
log.info("Openen ZIP bestand " + fileName);
ZipInputStream zip = null;
try {
File f = new File(fileName);
File f = Path.of(fileName).toFile();
if (listener != null) {
listener.total(f.length());
}
CountingInputStream zipCis =
new CountingInputStream(new FileInputStream(f)) {
new CountingInputStream(Files.newInputStream(f.toPath())) {
@Override
protected synchronized void afterRead(int n) throws IOException {
super.afterRead(n);
Expand Down Expand Up @@ -405,12 +406,11 @@ protected synchronized void afterRead(int n) throws IOException {
}
log.info("Klaar met ZIP bestand " + fileName);
} else {
File f = new File(fileName);
if (listener != null) {
listener.total(f.length());
listener.total(Path.of(fileName).toFile().length());
}

try (FileInputStream fis = new FileInputStream(fileName)) {
try (InputStream fis = Files.newInputStream(Path.of(fileName))) {
stagingProxy.loadBr(fis, type, fileName, null, listener, automatischProces);
}
}
Expand Down Expand Up @@ -696,8 +696,8 @@ public void updateLaadProcesMeta(
}

public File checkAfgiftelijst(String bestandsnaam, String output) throws IOException {
File f = new File(bestandsnaam);
return checkAfgiftelijst(bestandsnaam, new FileInputStream(f), new File(output));
return checkAfgiftelijst(
bestandsnaam, Files.newInputStream(Path.of(bestandsnaam)), Path.of(output).toFile());
}

public File checkAfgiftelijst(String bestandsnaam, InputStream is, File output)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@
package nl.b3p.brmo.loader.checks;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.nio.file.Files;
import java.nio.file.Path;
import java.sql.SQLException;
import java.util.List;
import java.util.Map;
Expand All @@ -39,7 +40,7 @@ public class AfgifteChecker {
private StagingProxy staging;

public void init(String input, StagingProxy staging) throws IOException {
try (FileInputStream fin = new FileInputStream(new File(input))) {
try (InputStream fin = Files.newInputStream(Path.of(input))) {
init(fin, staging);
}
}
Expand Down Expand Up @@ -94,10 +95,6 @@ private void processFoundLaadprocess(Afgifte afgifte, LaadProces lp) throws SQLE
(bericht) -> counts.put(bericht.getStatus(), counts.get(bericht.getStatus()) + 1));
}

public File getResults(String input, String f) throws IOException {
return getResults(input, new File(f));
}

public File getResults(String input, File f) throws IOException {
AfgiftelijstReport reporter = new AfgiftelijstReport();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,13 @@
import nl.b3p.topnl.TopNLType;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.gaul.modernizer_maven_annotations.SuppressModernizer;
import org.jdom2.JDOMException;

/**
* @author Meine Toonen
*/
@SuppressModernizer
public class TopNLRsgbTransformer implements Runnable {

private static final Log LOG = LogFactory.getLog(TopNLRsgbTransformer.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,12 @@
import java.util.StringTokenizer;
import nl.b3p.brmo.loader.BrmoFramework;
import nl.b3p.brmo.loader.entity.Bericht;
import org.gaul.modernizer_maven_annotations.SuppressModernizer;

/**
* @author Mark Prins
*/
@SuppressModernizer
public class TopNLFileReader extends BrmoXMLReader {

private long fileSize = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import org.dbunit.ext.oracle.Oracle10DataTypeFactory;
import org.dbunit.ext.postgresql.PostgresqlDataTypeFactory;
import org.dbunit.operation.DatabaseOperation;
import org.gaul.modernizer_maven_annotations.SuppressModernizer;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.DisplayName;
Expand All @@ -48,6 +49,7 @@
* -Dtest.onlyITs=true verify -Ppostgresql -pl :brmo-loader > /tmp/postgresql.log} voor bijvoorbeeld
* PostgreSQL
*/
@SuppressModernizer
public class BedrijfAlsFuntionarisNhrToStagingToRsgbIntegrationTest
extends AbstractDatabaseIntegrationTest {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import org.dbunit.ext.oracle.Oracle10DataTypeFactory;
import org.dbunit.ext.postgresql.PostgresqlDataTypeFactory;
import org.dbunit.operation.DatabaseOperation;
import org.gaul.modernizer_maven_annotations.SuppressModernizer;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.DisplayName;
Expand All @@ -51,6 +52,7 @@
*
* @author mprins
*/
@SuppressModernizer
class Brk2MutatieVerwijderVerwerkingIntegrationTest extends AbstractDatabaseIntegrationTest {

private static final Log LOG =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
import org.dbunit.ext.oracle.Oracle10DataTypeFactory;
import org.dbunit.ext.postgresql.PostgresqlDataTypeFactory;
import org.dbunit.operation.DatabaseOperation;
import org.gaul.modernizer_maven_annotations.SuppressModernizer;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.DisplayName;
Expand All @@ -59,6 +60,7 @@
* @todo Deze test draait niet op github omdat er nogal eens een database fout optreed.
*/
@Tag("skip-flakey-pgsql-github")
@SuppressModernizer
class Brk2StandMutatieGedeeldeStukkenVerwerkingIntegrationTest
extends AbstractDatabaseIntegrationTest {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import org.dbunit.ext.oracle.Oracle10DataTypeFactory;
import org.dbunit.ext.postgresql.PostgresqlDataTypeFactory;
import org.dbunit.operation.DatabaseOperation;
import org.gaul.modernizer_maven_annotations.SuppressModernizer;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.DisplayName;
Expand All @@ -52,6 +53,7 @@
*
* @author mprins
*/
@SuppressModernizer
class Brk2StandMutatieVerwerkingIntegrationTest extends AbstractDatabaseIntegrationTest {

private static final Log LOG = LogFactory.getLog(Brk2StandMutatieVerwerkingIntegrationTest.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import org.dbunit.ext.oracle.Oracle10DataTypeFactory;
import org.dbunit.ext.postgresql.PostgresqlDataTypeFactory;
import org.dbunit.operation.DatabaseOperation;
import org.gaul.modernizer_maven_annotations.SuppressModernizer;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.DisplayName;
Expand All @@ -53,6 +54,7 @@
*
* @author mprins
*/
@SuppressModernizer
class Brk2ToStagingToRsgbBrkIntegrationTest extends AbstractDatabaseIntegrationTest {

private static final Log LOG = LogFactory.getLog(Brk2ToStagingToRsgbBrkIntegrationTest.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
import org.dbunit.ext.oracle.Oracle10DataTypeFactory;
import org.dbunit.ext.postgresql.PostgresqlDataTypeFactory;
import org.dbunit.operation.DatabaseOperation;
import org.gaul.modernizer_maven_annotations.SuppressModernizer;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
Expand All @@ -58,6 +59,7 @@
*
* @author Mark Prins
*/
@SuppressModernizer
public class GBAVXMLToStagingIntegrationTest extends AbstractDatabaseIntegrationTest {

static Stream<Arguments> argumentsProvider() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import org.dbunit.ext.oracle.Oracle10DataTypeFactory;
import org.dbunit.ext.postgresql.PostgresqlDataTypeFactory;
import org.dbunit.operation.DatabaseOperation;
import org.gaul.modernizer_maven_annotations.SuppressModernizer;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.DisplayName;
Expand All @@ -47,6 +48,7 @@
* Draaien met: {@code mvn -Dit.test=GH522NhrToStagingToRsgbIntegrationTest -Dtest.onlyITs=true
* verify -Ppostgresql -pl :brmo-loader > /tmp/postgresql.log} voor bijvoorbeeld PostgreSQL
*/
@SuppressModernizer
public class GH522NhrToStagingToRsgbIntegrationTest extends AbstractDatabaseIntegrationTest {

private static final Log LOG = LogFactory.getLog(GH522NhrToStagingToRsgbIntegrationTest.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import org.dbunit.ext.oracle.Oracle10DataTypeFactory;
import org.dbunit.ext.postgresql.PostgresqlDataTypeFactory;
import org.dbunit.operation.DatabaseOperation;
import org.gaul.modernizer_maven_annotations.SuppressModernizer;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
Expand All @@ -39,6 +40,7 @@
* Draaien met: {@code mvn -Dit.test=GH527NhrToStagingToRsgbIntegrationTest -Dtest.onlyITs=true
* verify -Ppostgresql -pl :brmo-loader > /tmp/postgresql.log} voor bijvoorbeeld PostgreSQL
*/
@SuppressModernizer
public class GH527NhrToStagingToRsgbIntegrationTest extends AbstractDatabaseIntegrationTest {

private static final Log LOG = LogFactory.getLog(GH527NhrToStagingToRsgbIntegrationTest.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
import org.dbunit.ext.oracle.Oracle10DataTypeFactory;
import org.dbunit.ext.postgresql.PostgresqlDataTypeFactory;
import org.dbunit.operation.DatabaseOperation;
import org.gaul.modernizer_maven_annotations.SuppressModernizer;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.params.ParameterizedTest;
Expand All @@ -50,6 +51,7 @@
*
* @author Mark Prins
*/
@SuppressModernizer
public class Mantis15059BedrijfAlsFunctionarisIntegrationTest
extends AbstractDatabaseIntegrationTest {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import org.dbunit.ext.oracle.Oracle10DataTypeFactory;
import org.dbunit.ext.postgresql.PostgresqlDataTypeFactory;
import org.dbunit.operation.DatabaseOperation;
import org.gaul.modernizer_maven_annotations.SuppressModernizer;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Assumptions;
import org.junit.jupiter.api.BeforeEach;
Expand All @@ -48,6 +49,7 @@
*
* @author Mark Prins
*/
@SuppressModernizer
public class NhrToStagingToRsgbIntegrationTest extends AbstractDatabaseIntegrationTest {

private static final Log LOG = LogFactory.getLog(NhrToStagingToRsgbIntegrationTest.class);
Expand Down
2 changes: 2 additions & 0 deletions brmo-loader/src/test/java/nl/b3p/TopNLIntegrationTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
import org.dbunit.ext.oracle.Oracle10DataTypeFactory;
import org.dbunit.ext.postgresql.PostgresqlDataTypeFactory;
import org.dbunit.operation.DatabaseOperation;
import org.gaul.modernizer_maven_annotations.SuppressModernizer;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.DisplayName;
Expand All @@ -67,6 +68,7 @@
*
* @author Mark Prins
*/
@SuppressModernizer
public class TopNLIntegrationTest extends AbstractDatabaseIntegrationTest {

private static final Log LOG = LogFactory.getLog(TopNLIntegrationTest.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
import org.dbunit.ext.oracle.Oracle10DataTypeFactory;
import org.dbunit.ext.postgresql.PostgresqlDataTypeFactory;
import org.dbunit.operation.DatabaseOperation;
import org.gaul.modernizer_maven_annotations.SuppressModernizer;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Tag;
Expand All @@ -62,6 +63,7 @@
* @author Mark Prins
*/
@Tag("skip-windows-java11")
@SuppressModernizer
public class WozXMLToStagingIntegrationTest extends AbstractDatabaseIntegrationTest {

private static final Log LOG = LogFactory.getLog(WozXMLToStagingIntegrationTest.class);
Expand Down

0 comments on commit f2f8cb1

Please sign in to comment.