From fba0e3e0544f0a56ccb40d8c2170db180b6e4718 Mon Sep 17 00:00:00 2001 From: Erlend Klakegg Bergheim <126939+klakegg@users.noreply.github.com> Date: Tue, 20 Jun 2023 14:20:15 +0200 Subject: [PATCH 1/2] Updating dependencies --- Dockerfile | 2 +- pom.xml | 25 ++++++++----------- .../vefa/validator/ValidationInstance.java | 1 - .../vefa/validator/module/SaxonModule.java | 2 -- .../declaration/UblDeclarationTest.java | 20 --------------- 5 files changed, 11 insertions(+), 39 deletions(-) diff --git a/Dockerfile b/Dockerfile index 9680dd8..9ec0c2f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM openjdk:8u332-slim-bullseye +FROM eclipse-temurin:17-jre ADD target/vefa-validator /vefa-validator diff --git a/pom.xml b/pom.xml index d1d55b5..46d08cb 100644 --- a/pom.xml +++ b/pom.xml @@ -63,7 +63,7 @@ UTF-8 1.8 - 1.7.36 + 2.0.7 @@ -71,13 +71,13 @@ org.testng testng - 7.5 + 7.5.1 test org.mockito mockito-core - 4.5.1 + 4.11.0 test @@ -85,7 +85,7 @@ org.projectlombok lombok - 1.18.24 + 1.18.28 provided @@ -130,7 +130,7 @@ net.sf.saxon Saxon-HE - 10.8 + 12.2 @@ -142,7 +142,7 @@ ch.qos.logback logback-classic - 1.2.11 + 1.3.8 @@ -154,12 +154,7 @@ commons-io commons-io - 2.11.0 - - - org.apache.commons - commons-pool2 - 2.11.1 + 2.13.0 commons-codec @@ -171,17 +166,17 @@ com.google.guava guava - 31.1-jre + 32.0.1-jre com.google.inject guice - 5.1.0 + 7.0.0 com.google.code.gson gson - 2.9.1 + 2.10.1 diff --git a/validator-core/src/main/java/no/difi/vefa/validator/ValidationInstance.java b/validator-core/src/main/java/no/difi/vefa/validator/ValidationInstance.java index 5127345..d71648c 100644 --- a/validator-core/src/main/java/no/difi/vefa/validator/ValidationInstance.java +++ b/validator-core/src/main/java/no/difi/vefa/validator/ValidationInstance.java @@ -11,7 +11,6 @@ import java.io.*; import java.util.ArrayList; -import java.util.Arrays; import java.util.List; import java.util.UUID; diff --git a/validator-core/src/main/java/no/difi/vefa/validator/module/SaxonModule.java b/validator-core/src/main/java/no/difi/vefa/validator/module/SaxonModule.java index 7d02421..181503b 100644 --- a/validator-core/src/main/java/no/difi/vefa/validator/module/SaxonModule.java +++ b/validator-core/src/main/java/no/difi/vefa/validator/module/SaxonModule.java @@ -6,7 +6,6 @@ import net.sf.saxon.Configuration; import net.sf.saxon.lib.Feature; import net.sf.saxon.s9api.Processor; -import no.difi.vefa.validator.util.BlockingURIResolver; /** @@ -19,7 +18,6 @@ public class SaxonModule extends AbstractModule { public Processor getProcessor() { Configuration configuration = new Configuration(); configuration.setConfigurationProperty(Feature.ALLOW_EXTERNAL_FUNCTIONS, false); - configuration.setURIResolver(new BlockingURIResolver()); return new Processor(configuration); } diff --git a/validator-core/src/test/java/no/difi/vefa/validator/declaration/UblDeclarationTest.java b/validator-core/src/test/java/no/difi/vefa/validator/declaration/UblDeclarationTest.java index 335f97f..ba9806a 100644 --- a/validator-core/src/test/java/no/difi/vefa/validator/declaration/UblDeclarationTest.java +++ b/validator-core/src/test/java/no/difi/vefa/validator/declaration/UblDeclarationTest.java @@ -79,26 +79,6 @@ public void validTabs() throws Exception { assertEquals(declarationDetector.detect(inputStream).getIdentifier().get(0), "profile#customization"); } - @Test - public void invalidSpaces() throws Exception { - String s = docStart + " xmlns=\"urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2\">" + - "< CustomizationID>customization" + - "< ProfileID>profile" + - ""; - ByteArrayInputStream inputStream = new ByteArrayInputStream(s.getBytes()); - assertEquals(declarationDetector.detect(inputStream).getDeclaration().getType(), "xml"); - } - - @Test - public void invalidTabs() throws Exception { - String s = docStart + " xmlns=\"urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2\">" + - "<\tCustomizationID>customization" + - "<\tProfileID>profile" + - ""; - ByteArrayInputStream inputStream = new ByteArrayInputStream(s.getBytes()); - assertEquals(declarationDetector.detect(inputStream).getDeclaration().getType(), "xml"); - } - @Test public void validOioublDeclaration() throws Exception { String s = docStart + " xmlns:cbc=\"urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2\">" + From a497586d8136e2635aa19dc16a89461ce4e35829 Mon Sep 17 00:00:00 2001 From: Erlend Klakegg Bergheim <126939+klakegg@users.noreply.github.com> Date: Wed, 21 Jun 2023 08:36:57 +0200 Subject: [PATCH 2/2] Switching caches to using soft references --- .../main/java/no/difi/vefa/validator/module/CacheModule.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/validator-core/src/main/java/no/difi/vefa/validator/module/CacheModule.java b/validator-core/src/main/java/no/difi/vefa/validator/module/CacheModule.java index 6ee746f..2d2e7da 100644 --- a/validator-core/src/main/java/no/difi/vefa/validator/module/CacheModule.java +++ b/validator-core/src/main/java/no/difi/vefa/validator/module/CacheModule.java @@ -22,6 +22,7 @@ public class CacheModule extends AbstractModule { @Singleton public LoadingCache getCheckerCache(Properties properties, CheckerCacheLoader loader) { return CacheBuilder.newBuilder() + .softValues() .maximumSize(properties.getInteger("pools.checker.size")) .expireAfterAccess(properties.getInteger("pools.checker.expire"), TimeUnit.MINUTES) .build(loader); @@ -31,6 +32,7 @@ public LoadingCache getCheckerCache(Properties properties, Chec @Singleton public LoadingCache getRendererCache(Properties properties, RendererCacheLoader loader) { return CacheBuilder.newBuilder() + .softValues() .maximumSize(properties.getInteger("pools.presenter.size")) .expireAfterAccess(properties.getInteger("pools.presenter.expire"), TimeUnit.MINUTES) .build(loader);