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

Code cleanup to correct issues reported by Sonar (Consistency) #2967

Merged
merged 86 commits into from
Apr 24, 2024
Merged
Show file tree
Hide file tree
Changes from 81 commits
Commits
Show all changes
86 commits
Select commit Hold shift + click to select a range
625fd76
add test to avoid NullPointerException
rolnico Apr 5, 2024
5c8d233
fix return statement in MergedBus
rolnico Apr 5, 2024
6f77f25
add test to avoid potential ArrayIndexOutOfBoundsException
rolnico Apr 5, 2024
624c337
BREAKING CHANGE - Change JsonTypeInfo to avoid unsafe Jackson deseria…
rolnico Apr 5, 2024
aa523f1
fix GeneratorModificationActionTest
rolnico Apr 5, 2024
489d5ff
remove peek usage
rolnico Apr 8, 2024
c5d232c
remove duplicated tests
rolnico Apr 8, 2024
05de80b
remove exceptions not thrown
rolnico Apr 8, 2024
7f23910
if simplifications
rolnico Apr 8, 2024
bcd721f
removed unused methods
rolnico Apr 8, 2024
21da610
use Supplier from java instead if guava
rolnico Apr 8, 2024
b3ce26c
use Supplier from java instead if guava
rolnico Apr 8, 2024
9867b6d
ParsingContext declared final
rolnico Apr 8, 2024
6792363
XmlStaxContext declared final
rolnico Apr 8, 2024
266e337
replaced deprecated method for ZipFile with SeekableByteChannel
rolnico Apr 8, 2024
1a38ad6
swapped from deprecated org.apache.commons.compress.utils.IOUtils to …
rolnico Apr 8, 2024
0afcfbc
removed deprecated .newInstance method call
rolnico Apr 8, 2024
e81dc90
EmptyModuleConfigRepository declared final
rolnico Apr 8, 2024
8541b77
removed old deprecated methods + replaced guava supplier by java supp…
rolnico Apr 8, 2024
d836935
replaced deprecated Zipfile constructor by builder
rolnico Apr 8, 2024
59fd06e
replaced supplier
rolnico Apr 8, 2024
d7a6662
fix
rolnico Apr 8, 2024
06cbf2c
fix
rolnico Apr 8, 2024
0e3d1b7
fix StandardCharsets.UTF_8
rolnico Apr 8, 2024
4e1cf4a
fix
rolnico Apr 8, 2024
7a8c0eb
fix
rolnico Apr 8, 2024
af70c7f
replace supplier
rolnico Apr 8, 2024
05235c0
replace ZipFile by builder
rolnico Apr 8, 2024
afe04ce
catch Exception instead of Throwable
rolnico Apr 8, 2024
f5ef925
group logic in createComputationManager for shortTime and longTime co…
rolnico Apr 8, 2024
64af211
replace supplier
rolnico Apr 8, 2024
b66d047
remove deprecated methods in PlatformConfigNamedProvider
rolnico Apr 8, 2024
e7d471b
clean DynamicSimulationParameters
rolnico Apr 8, 2024
5398858
replace supplier
rolnico Apr 8, 2024
57d9ba1
clean Networks
rolnico Apr 8, 2024
6c1b6b7
remove old deprecated methods in StandbyAutomaton
rolnico Apr 8, 2024
85c9d41
remove old deprecated methods in StandbyAutomaton
rolnico Apr 8, 2024
d7bfc1d
remove old deprecated methods in StandbyAutomatonAdder
rolnico Apr 8, 2024
cb18318
Renamed "RL" to match the regular expression '^[A-Z][0-9]?$'.
rolnico Apr 8, 2024
920a3a1
Renamed "OWNER" to match the regular expression '^[A-Z][0-9]?$'.
rolnico Apr 8, 2024
2ee5055
Renamed "OWNER" to match the regular expression '^[A-Z][0-9]?$'.
rolnico Apr 8, 2024
44955f5
fix ReactiveCapabilityCurveAdderImpl
rolnico Apr 8, 2024
3f346ef
Rename "RL" to match the regular expression '^[A-Z][0-9]?$'.
rolnico Apr 8, 2024
c58e61a
changed supplier
rolnico Apr 8, 2024
d761eee
extract closeAndUseGarbageCollector in XMLImporter
rolnico Apr 8, 2024
aa5618b
fix Networks
rolnico Apr 8, 2024
4bb71e7
use List.of
rolnico Apr 8, 2024
a663970
remove import
rolnico Apr 8, 2024
6068329
concat duplicated test in one parametrized
rolnico Apr 8, 2024
3997949
use Map.of
rolnico Apr 8, 2024
e3ffea3
streams in try with resources
rolnico Apr 8, 2024
f64f4d4
remove import
rolnico Apr 8, 2024
0f92791
changed supplier + Stream.toList()
rolnico Apr 8, 2024
3af20d2
fix logger class
rolnico Apr 8, 2024
4e4273a
fix ValidationUtils
rolnico Apr 8, 2024
79f771e
make inner classes static in AbstractValidationFormatterWriter
rolnico Apr 8, 2024
ab5be9c
removed deprecated method UndirectedGraph.getMaxVertex
rolnico Apr 8, 2024
eeb2475
removed blank lines
rolnico Apr 8, 2024
3ff8441
fix map with preserved order
rolnico Apr 10, 2024
46103a3
fix PsseExporter issues
rolnico Apr 10, 2024
66c58ea
simplify condition
rolnico Apr 10, 2024
f14362b
swap Supplier
rolnico Apr 10, 2024
11ef1a7
swap Supplier
rolnico Apr 10, 2024
480ef80
swap Supplier
rolnico Apr 10, 2024
41b3e94
swap Supplier + string variable
rolnico Apr 10, 2024
350bbd3
swap Supplier
rolnico Apr 10, 2024
5dd35e4
replace 3 tests with one parametrized
rolnico Apr 10, 2024
5fb9736
fix ExporterTest issues
rolnico Apr 10, 2024
2a36e4e
swap supplier
rolnico Apr 10, 2024
02a54ff
replaced 3 tests with one parametrized
rolnico Apr 10, 2024
fe39abe
fix TimeSeriesMetadata issues
rolnico Apr 10, 2024
dc113b4
replace ImmutableMap with Collections.unmodifiableMap(LinkedHashMap)
rolnico Apr 10, 2024
aafadaa
replace XMLSchema.STRING with XSD.STRING
rolnico Apr 10, 2024
f6381cf
replace XMLSchema.STRING with XSD.STRING
rolnico Apr 10, 2024
8194926
regroup 17 tests in 4 parametrized tests
rolnico Apr 10, 2024
bd66190
switch conditions
rolnico Apr 16, 2024
6665e3d
Merge branch 'main' into nro/cleanup
annetill Apr 23, 2024
81e55d1
fix for review
rolnico Apr 24, 2024
138f364
Merge branch 'refs/heads/main' into nro/cleanup
rolnico Apr 24, 2024
8457e18
fix indentation
rolnico Apr 24, 2024
b8ceacf
coverage
rolnico Apr 24, 2024
31d7ddc
fix imports
rolnico Apr 24, 2024
f76c3be
fix exceptions
rolnico Apr 24, 2024
64ab16a
fix checkstyle + newline character
rolnico Apr 24, 2024
b5fdf09
fix newline character + regroup exceptions + add comment
rolnico Apr 24, 2024
de1526e
delete unused import
rolnico Apr 24, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@
import groovy.lang.GroovyCodeSource;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.Arguments;
import org.junit.jupiter.params.provider.MethodSource;

import java.util.Objects;
import java.util.stream.Stream;

import static org.junit.jupiter.api.Assertions.*;

Expand All @@ -36,7 +42,7 @@ void setUp() {
@Test
void testExceptionOnWrongGeneratorId() {
ActionDb actionDb = new ActionDslLoader(
new GroovyCodeSource(getClass().getResource("/generator-modification-action.groovy"))).load(network);
new GroovyCodeSource(Objects.requireNonNull(getClass().getResource("/generator-modification-action.groovy")))).load(network);
Action action = actionDb.getAction("unknown generator");
NetworkModification genModif = action.getModifications().get(0);
// should throw with ThrowException = true
Expand All @@ -48,7 +54,7 @@ void testExceptionOnWrongGeneratorId() {

@Test
void testTargetVAndQWithVoltageRegulatorOff() {
ActionDb actionDb = new ActionDslLoader(new GroovyCodeSource(getClass().getResource("/generator-modification-action.groovy"))).load(network);
ActionDb actionDb = new ActionDslLoader(new GroovyCodeSource(Objects.requireNonNull(getClass().getResource("/generator-modification-action.groovy")))).load(network);
Action action = actionDb.getAction("targetV and targetQ with voltageRegulator OFF");
action.run(network);
assertEquals(20., g.getMinP(), 0.1);
Expand All @@ -61,63 +67,43 @@ void testTargetVAndQWithVoltageRegulatorOff() {

@Test
void testTargetVAndQWithVoltageRegulatorOn() {
ActionDb actionDb = new ActionDslLoader(new GroovyCodeSource(getClass().getResource("/generator-modification-action.groovy"))).load(network);
ActionDb actionDb = new ActionDslLoader(new GroovyCodeSource(Objects.requireNonNull(getClass().getResource("/generator-modification-action.groovy")))).load(network);
Action action = actionDb.getAction("targetV and targetQ with voltageRegulator ON");
action.run(network);
assertEquals(10, g.getTargetV(), 0.1);
assertEquals(25., g.getTargetQ(), 0.1);
assertTrue(g.isVoltageRegulatorOn());
}

@Test
void testDeltaTargetPInBoundaries() {
ActionDb actionDb = new ActionDslLoader(new GroovyCodeSource(getClass().getResource("/generator-modification-action.groovy"))).load(network);
Action action = actionDb.getAction("deltaTargetP within boundaries");
action.run(network);
assertEquals(606., g.getTargetP(), 0.1);
}

@Test
void testDeltaTargetPLowerBoundaryOverflow() {
ActionDb actionDb = new ActionDslLoader(new GroovyCodeSource(getClass().getResource("/generator-modification-action.groovy"))).load(network);
Action action = actionDb.getAction("deltaTargetP lower boundary overflow");
action.run(network);
assertEquals(-9999.99, g.getTargetP(), 0.1);
}

@Test
void testDeltaTargetPUpperBoundaryOverflow() {
ActionDb actionDb = new ActionDslLoader(new GroovyCodeSource(getClass().getResource("/generator-modification-action.groovy"))).load(network);
Action action = actionDb.getAction("deltaTargetP upper boundary overflow");
action.run(network);
assertEquals(9999.99, g.getTargetP(), 0.1);
}

@Test
void testTargetPLowerBoundaryOverflow() {
ActionDb actionDb = new ActionDslLoader(new GroovyCodeSource(getClass().getResource("/generator-modification-action.groovy"))).load(network);
Action action = actionDb.getAction("targetP lower boundary overflow");
action.run(network);
assertEquals(-9999.99, g.getTargetP(), 0.1);
static Stream<Arguments> getArguments() {
return Stream.of(
Arguments.of("deltaTargetP within boundaries", 606.),
Arguments.of("deltaTargetP upper boundary overflow", 9999.99),
Arguments.of("deltaTargetP lower boundary overflow", -9999.99),
Arguments.of("targetP upper boundary overflow", 9999.99),
Arguments.of("targetP lower boundary overflow", -9999.99)
);
}

@Test
void testTargetPUpperBoundaryOverflow() {
ActionDb actionDb = new ActionDslLoader(new GroovyCodeSource(getClass().getResource("/generator-modification-action.groovy"))).load(network);
Action action = actionDb.getAction("targetP upper boundary overflow");
@ParameterizedTest
@MethodSource("getArguments")
void testActionsFromDb(String actionName, double expectedValue) {
ActionDb actionDb = new ActionDslLoader(new GroovyCodeSource(Objects.requireNonNull(getClass().getResource("/generator-modification-action.groovy")))).load(network);
Action action = actionDb.getAction(actionName);
action.run(network);
assertEquals(9999.99, g.getTargetP(), 0.1);
assertEquals(expectedValue, g.getTargetP(), 0.1);
}

@Test
void testBothTargetpAndDeltaTargetP() {
PowsyblException e = assertThrows(PowsyblException.class, () -> new ActionDslLoader(new GroovyCodeSource(getClass().getResource("/exception-generator-modification-action.groovy"))).load(network));
ActionDslLoader actionDslLoader = new ActionDslLoader(new GroovyCodeSource(Objects.requireNonNull(getClass().getResource("/exception-generator-modification-action.groovy"))));
PowsyblException e = assertThrows(PowsyblException.class, () -> actionDslLoader.load(network));
assertTrue(e.getMessage().contains("targetP/deltaTargetP actions are both found in generatorModification on 'GEN'"));
}

@Test
void testConnectionOnOff() {
ActionDb actionDb = new ActionDslLoader(new GroovyCodeSource(getClass().getResource("/generator-modification-action.groovy"))).load(network);
ActionDb actionDb = new ActionDslLoader(new GroovyCodeSource(Objects.requireNonNull(getClass().getResource("/generator-modification-action.groovy")))).load(network);
Action action = actionDb.getAction("disconnect");
action.run(network);
assertFalse(g.getTerminal().isConnected());
Expand All @@ -128,7 +114,7 @@ void testConnectionOnOff() {

@Test
void testConnectionOnOffWithTargetPChange() {
ActionDb actionDb = new ActionDslLoader(new GroovyCodeSource(getClass().getResource("/generator-modification-action.groovy"))).load(network);
ActionDb actionDb = new ActionDslLoader(new GroovyCodeSource(Objects.requireNonNull(getClass().getResource("/generator-modification-action.groovy")))).load(network);
Action action = actionDb.getAction("disconnect with targetP change");
action.run(network);
assertFalse(g.getTerminal().isConnected());
Expand All @@ -141,7 +127,7 @@ void testConnectionOnOffWithTargetPChange() {

@Test
void testAlreadyAtTheConnectionStateAsked() {
ActionDb actionDb = new ActionDslLoader(new GroovyCodeSource(getClass().getResource("/generator-modification-action.groovy"))).load(network);
ActionDb actionDb = new ActionDslLoader(new GroovyCodeSource(Objects.requireNonNull(getClass().getResource("/generator-modification-action.groovy")))).load(network);
Action action = actionDb.getAction("connect");
action.run(network);
assertTrue(g.getTerminal().isConnected());
Expand All @@ -154,7 +140,7 @@ void testAlreadyAtTheConnectionStateAsked() {

@Test
void testConnectionOnOffWithTargetVChange() {
ActionDb actionDb = new ActionDslLoader(new GroovyCodeSource(getClass().getResource("/generator-modification-action.groovy"))).load(network);
ActionDb actionDb = new ActionDslLoader(new GroovyCodeSource(Objects.requireNonNull(getClass().getResource("/generator-modification-action.groovy")))).load(network);
Action action = actionDb.getAction("disconnect");
action.run(network);
assertFalse(g.getTerminal().isConnected());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -810,9 +810,10 @@ private void voltageAngles(PropertyBags nodes, Context context) {
private void clearUnattachedHvdcConverterStations(Network network, Context context) {
network.getHvdcConverterStationStream()
.filter(converter -> converter.getHvdcLine() == null)
.peek(converter -> context.ignored("HVDC Converter Station " + converter.getId(), "No correct linked HVDC line found."))
.toList()
.forEach(Connectable::remove);
.forEach(converter -> {
context.ignored("HVDC Converter Station " + converter.getId(), "No correct linked HVDC line found.");
converter.remove();
});
}

private void debugTopology(Context context) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@
import com.powsybl.cgmes.conversion.PhaseAngleClock;
import com.powsybl.cgmes.model.GridModelReference;
import com.powsybl.commons.PowsyblException;
import com.powsybl.iidm.network.*;
import com.powsybl.iidm.network.Network;
import com.powsybl.iidm.network.Terminal;
import com.powsybl.iidm.network.ThreeWindingsTransformer;
import com.powsybl.iidm.network.TwoWindingsTransformer;
import com.powsybl.loadflow.LoadFlowParameters;
import com.powsybl.loadflow.validation.ValidationConfig;
import org.junit.jupiter.api.Test;
Expand All @@ -37,6 +40,8 @@
*/
class TransformerConversionTest {

private static final String EQUALS_LINE = "======================";

@Test
void microGridBaseCaseBExfmr2ShuntDefault() {
Conversion.Config config = new Conversion.Config();
Expand Down Expand Up @@ -199,8 +204,16 @@ void microGridBaseCaseBExfmr2Ratio0X() {
assertTrue(ok);
}

/**
* Default test for:
* <ul>
* <li>microGridBaseCaseBExfmr3Shunt</ul>
* <li>microGridBaseCaseBExfmr3RatioPhase</ul>
* <li>microGridBaseCaseBExfmr3Ratio0</ul>
* </ul>
*/
@Test
void microGridBaseCaseBExfmr3ShuntDefault() {
void microGridBaseCaseDefault() {
Conversion.Config config = new Conversion.Config();
Network n = networkModel(CgmesConformity1Catalog.microGridBaseCaseBE(), config);

Expand Down Expand Up @@ -243,16 +256,6 @@ void microGridBaseCaseBExfmr3ShuntSplit() {
assertTrue(ok);
}

@Test
void microGridBaseCaseBExfmr3RatioPhaseDefault() {
Conversion.Config config = new Conversion.Config();
Network n = networkModel(CgmesConformity1Catalog.microGridBaseCaseBE(), config);

// RatioTapChanger
boolean ok = t3xCompareFlow(n, "84ed55f4-61f5-4d9d-8755-bba7b877a246", 99.227288, 2.747147, -216.195867, -85.490493, 117.988318, 92.500849);
assertTrue(ok);
}

@Test
void microGridBaseCaseBExfmr3RatioPhaseNetworkSide() {
Conversion.Config config = new Conversion.Config();
Expand All @@ -275,16 +278,6 @@ void microGridBaseCaseBExfmr3RatioPhaseStarBusSide() {
assertTrue(ok);
}

@Test
void microGridBaseCaseBExfmr3Ratio0Default() {
Conversion.Config config = new Conversion.Config();
Network n = networkModel(CgmesConformity1Catalog.microGridBaseCaseBE(), config);

// RatioTapChanger
boolean ok = t3xCompareFlow(n, "84ed55f4-61f5-4d9d-8755-bba7b877a246", 99.227288, 2.747147, -216.195867, -85.490493, 117.988318, 92.500849);
assertTrue(ok);
}

@Test
void microGridBaseCaseBExfmr3Ratio0StarBusSide() {
Conversion.Config config = new Conversion.Config();
Expand Down Expand Up @@ -423,7 +416,7 @@ private boolean t2xCompareFlow(Network n, String id, double p1, double q1, doubl
LOG.error(String.format("TransformerConversionTest: TwoWindingsTransformer id %s ===", id));
LOG.error(String.format("Expected P1 %12.6f Q1 %12.6f P2 %12.6f Q2 %12.6f", expected.p1, expected.q1, expected.p2, expected.q2));
LOG.error(String.format("Actual P1 %12.6f Q1 %12.6f P2 %12.6f Q2 %12.6f", actual.p1, actual.q1, actual.p2, actual.q2));
LOG.error("======================");
LOG.error(EQUALS_LINE);
}
return ok;
}
Expand All @@ -443,7 +436,7 @@ private boolean t3xCompareFlow(Network n, String id, double p1, double q1, doubl
expected.q1, expected.p2, expected.q2, expected.p3, expected.q3));
LOG.error(String.format("Actual P1 %12.6f Q1 %12.6f P2 %12.6f Q2 %12.6f P3 %12.6f Q3 %12.6f", actual.p1,
actual.q1, actual.p2, actual.q2, actual.p3, actual.q3));
LOG.error("======================");
LOG.error(EQUALS_LINE);
}
return ok;
}
Expand Down Expand Up @@ -521,20 +514,20 @@ private boolean sameFlow(T2xFlow expected, T2xFlow actual) {
double tol = 0.00001;
// Comparison fails if actual has NaN values
return Math.abs(expected.p1 - actual.p1) <= tol &&
Math.abs(expected.q1 - actual.q1) <= tol &&
Math.abs(expected.p2 - actual.p2) <= tol &&
Math.abs(expected.q2 - actual.q2) <= tol;
Math.abs(expected.q1 - actual.q1) <= tol &&
Math.abs(expected.p2 - actual.p2) <= tol &&
Math.abs(expected.q2 - actual.q2) <= tol;
}

private boolean sameFlow(T3xFlow expected, T3xFlow actual) {
double tol = 0.00001;
// Comparison fails if actual has NaN values
return Math.abs(expected.p1 - actual.p1) <= tol &&
Math.abs(expected.q1 - actual.q1) <= tol &&
Math.abs(expected.p2 - actual.p2) <= tol &&
Math.abs(expected.q2 - actual.q2) <= tol &&
Math.abs(expected.p3 - actual.p3) <= tol &&
Math.abs(expected.q3 - actual.q3) <= tol;
Math.abs(expected.q1 - actual.q1) <= tol &&
Math.abs(expected.p2 - actual.p2) <= tol &&
Math.abs(expected.q2 - actual.q2) <= tol &&
Math.abs(expected.p3 - actual.p3) <= tol &&
Math.abs(expected.q3 - actual.q3) <= tol;
}

private LoadFlowParameters defineLoadflowParameters(LoadFlowParameters loadFlowParameters, Conversion.Config config) {
Expand Down Expand Up @@ -562,7 +555,7 @@ private LoadFlowParameters defineLoadflowParameters(LoadFlowParameters loadFlowP

if (t2wtSplitShuntAdmittance != t3wtSplitShuntAdmittance) {
throw new PowsyblException(String.format("Unexpected SplitShuntAdmittance configuration %s %s",
t2wtSplitShuntAdmittance, t3wtSplitShuntAdmittance));
t2wtSplitShuntAdmittance, t3wtSplitShuntAdmittance));
}
boolean twtSplitShuntAdmittance = t2wtSplitShuntAdmittance;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
*/
package com.powsybl.cgmes.model;

import com.google.common.base.Supplier;
import com.google.common.base.Suppliers;
import com.powsybl.commons.PowsyblException;
import com.powsybl.commons.exceptions.UncheckedXmlStreamException;
Expand All @@ -20,6 +19,7 @@
import java.io.Reader;
import java.time.ZonedDateTime;
import java.util.*;
import java.util.function.Supplier;

/**
*
Expand Down Expand Up @@ -119,7 +119,7 @@ public String toString() {
')';
}

private static class ParsingContext {
private static final class ParsingContext {

private String id;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

package com.powsybl.cgmes.model;

import com.google.common.base.Supplier;
import com.google.common.base.Suppliers;
import com.powsybl.commons.xml.XmlUtil;

Expand All @@ -19,6 +18,7 @@
import java.io.InputStream;
import java.util.HashSet;
import java.util.Set;
import java.util.function.Supplier;

/**
* @author Luma Zamarreño {@literal <zamarrenolm at aia.es>}
Expand Down
11 changes: 6 additions & 5 deletions cim-anonymiser/src/main/java/com/powsybl/cim/CimAnonymizer.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
*/
package com.powsybl.cim;

import com.google.common.collect.ImmutableSet;
import com.powsybl.commons.PowsyblException;
import com.powsybl.commons.exceptions.UncheckedXmlStreamException;
import com.powsybl.commons.util.StringAnonymizer;
Expand Down Expand Up @@ -52,9 +51,9 @@ public void logSkipped(Set<String> skipped) {
}
}

private static final Set<String> NAMES_TO_EXCLUDE = ImmutableSet.of("PATL", "TATL");
private static final Set<String> NAMES_TO_EXCLUDE = Set.of("PATL", "TATL");

private static final Set<String> DESCRIPTIONS_TO_EXCLUDE = ImmutableSet.of();
private static final Set<String> DESCRIPTIONS_TO_EXCLUDE = Set.of();

private static final String RDF_URI = "http://www.w3.org/1999/02/22-rdf-syntax-ns#";

Expand All @@ -64,7 +63,7 @@ public void logSkipped(Set<String> skipped) {
private static final QName RDF_RESOURCE = new QName(RDF_URI, "resource");
private static final QName RDF_ABOUT = new QName(RDF_URI, "about");

private static class XmlStaxContext {
private static final class XmlStaxContext {
private final XMLInputFactory inputFactory = XMLInputFactory.newFactory();
private final XMLOutputFactory outputFactory = XMLOutputFactory.newFactory();
private final XMLEventFactory eventFactory = XMLEventFactory.newInstance();
Expand Down Expand Up @@ -293,7 +292,9 @@ public void anonymizeZip(Path cimZipFile, Path anonymizedCimFileDir, Path dictio
StringAnonymizer dictionary = loadDic(dictionaryFile);

// anonymize each file of the archive
try (ZipFile zipFileData = new ZipFile(Files.newByteChannel(cimZipFile))) {
try (ZipFile zipFileData = ZipFile.builder()
.setSeekableByteChannel(Files.newByteChannel(cimZipFile))
.get()) {

Set<String> rdfIdValues = skipExternalRef ? getRdfIdValues(zipFileData) : null;

Expand Down
Loading
Loading