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

feat: upgrade dependencies to use Java 17 and jakarta #139

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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
83 changes: 51 additions & 32 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<name>KoSIT XML Prüftool Implementierung</name>

<groupId>de.kosit</groupId>
<version>1.5.0</version>
<version>1.5.1</version>

<artifactId>validationtool</artifactId>
<description>KoSIT XML Validator against XSD and Schematron based on defined scenarios.</description>
Expand Down Expand Up @@ -58,19 +58,19 @@
<version.commons-io>2.11.0</version.commons-io>
<version.commons-lang>3.12.0</version.commons-lang>
<version.jacoco>0.8.8</version.jacoco>
<version.jaxb>2.3.7</version.jaxb>
<version.jaxb>3.0.1</version.jaxb>
<version.lombok>1.18.24</version.lombok>
<version.mockito>4.9.0</version.mockito>
<version.owasp-dependency-check>7.2.0</version.owasp-dependency-check>
<version.rest-assured>5.2.0</version.rest-assured>
<version.saxon-he>11.4</version.saxon-he>
<version.saxon-he>12.5</version.saxon-he>
<version.slf4j>1.7.36</version.slf4j>
</properties>
<repositories>
<repository>
<id>project.local</id>
<name>project</name>
<url>file:${project.basedir}/libs</url>
<id>central</id>
<name>Maven Central</name>
<url>https://repo.maven.apache.org/maven2</url>
</repository>
</repositories>

Expand Down Expand Up @@ -122,6 +122,11 @@
<version>${version.jaxb}</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>jakarta.xml.bind</groupId>
<artifactId>jakarta.xml.bind-api</artifactId>
<version>${version.jaxb}</version>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
Expand Down Expand Up @@ -218,12 +223,19 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>3.10.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<source>17</source>
<target>17</target>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>3.1.0</version>
<configuration>
<encoding>UTF-8</encoding>
</configuration>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
Expand Down Expand Up @@ -270,8 +282,6 @@
<exclude>org.glassfish.jaxb:jaxb-runtime</exclude>
<exclude>com.sun.istack:istack-commons-runtime</exclude>
<exclude>com.sun.xml.fastinfoset:FastInfoset</exclude>
<exclude>jakarta.activation:jakarta.activation-api</exclude>
<exclude>jakarta.xml.bind:jakarta.xml.bind-api</exclude>
<exclude>org.jvnet.staxex:stax-ex</exclude>
<exclude>org.glassfish.jaxb:txw2</exclude>
</excludes>
Expand Down Expand Up @@ -323,9 +333,9 @@

<!-- Generate model classes -->
<plugin>
<groupId>org.jvnet.jaxb2.maven2</groupId>
<artifactId>maven-jaxb2-plugin</artifactId>
<version>0.15.1</version>
<groupId>org.jvnet.jaxb</groupId>
<artifactId>jaxb-maven-plugin</artifactId>
<version>4.0.8</version>
<executions>
<execution>
<goals>
Expand All @@ -343,18 +353,27 @@
</args>
<plugins>
<plugin>
<groupId>org.jvnet.jaxb2_commons</groupId>
<artifactId>jaxb2-basics</artifactId>
<version>0.11.1</version>
<groupId>org.jvnet.jaxb</groupId>
<artifactId>jaxb-plugins</artifactId>
<version>3.0.0</version>
</plugin>
</plugins>
</configuration>
<dependencies>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
<version>4.0.5</version>
</dependency>
<dependency>
<groupId>org.glassfish.jaxb</groupId>
<artifactId>jaxb-runtime</artifactId>
<version>4.0.5</version>
</dependency>
<dependency>
<groupId>jakarta.xml.bind</groupId>
<artifactId>jakarta.xml.bind-api</artifactId>
<version>${version.jaxb}</version>
<optional>true</optional>
</dependency>
</dependencies>
</plugin>
Expand Down Expand Up @@ -400,11 +419,11 @@
<goal>dump</goal>

</goals>
<configuration>
<address>localhost</address>
<port>${jacoco.tcp.port}</port>
<append>true</append>
</configuration>
<configuration>
<address>localhost</address>
<port>${jacoco.tcp.port}</port>
<append>true</append>
</configuration>
</execution>
<execution>
<id>generateJacocoReport</id>
Expand Down Expand Up @@ -453,15 +472,15 @@
<artifactId>exec-maven-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<execution>
<id>run</id>
<phase>pre-integration-test</phase>
<goals>
<phase>pre-integration-test</phase>
<goals>
<goal>exec</goal>
</goals>
</goals>
</execution>
</executions>
<configuration>
<configuration>
<executable>java</executable>
<longClasspath>false</longClasspath>
<async>true</async>
Expand All @@ -471,7 +490,7 @@
<argument>${jacocoFailsafe}</argument>
<argument>-Xmx128m</argument>
<argument>-classpath</argument>
<classpath />
<classpath/>
<argument>de.kosit.validationtool.cmd.CommandLineApplication</argument>
<argument>-s</argument>
<argument>${project.build.testOutputDirectory}/examples/simple/scenarios.xml</argument>
Expand All @@ -492,7 +511,7 @@
<configuration>
<target>
<!-- schlafen um den Start des Daemon abzuwarten -->
<sleep seconds="10" />
<sleep seconds="10"/>
<echo>${jacoco.tcp.port}</echo>
</target>
</configuration>
Expand All @@ -518,8 +537,8 @@
<goal>verify</goal>
</goals>
<configuration>
<!--suppress MavenModelInspection -->
<argLine>-Dfile.encoding=UTF-8 -Ddaemon.port=${validator.server.port}</argLine>
<!--suppress MavenModelInspection -->
<argLine>-Dfile.encoding=UTF-8 -Ddaemon.port=${validator.server.port}</argLine>
</configuration>

</execution>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public interface ResolvingConfigurationStrategy {
* function.
*
* @param scenarioRepository an optional repository, your implementation might not need this
* @return a preconfigured {@link net.sf.saxon.lib.UnparsedTextURIResolver} or null for using saxons default
* @return a preconfigured {@link UnparsedTextURIResolver} or null for using saxons default
*/
UnparsedTextURIResolver createUnparsedTextURIResolver(URI scenarioRepository);

Expand Down
8 changes: 4 additions & 4 deletions src/main/java/de/kosit/validationtool/cmd/Validator.java
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ private static ReturnValue processActions(final CommandLineOptions cmd) throws I
final Processor processor = ProcessorProvider.getProcessor();
final List<Configuration> config = getConfiguration(cmd);
final InternalCheck check = new InternalCheck(processor, config.toArray(new Configuration[0]));
final CommandLineOptions.CliOptions cliOptions = defaultIfNull(cmd.getCliOptions(), new CliOptions());
final CliOptions cliOptions = defaultIfNull(cmd.getCliOptions(), new CliOptions());
final Path outputDirectory = determineOutputDirectory(cliOptions);
if (cliOptions.isExtractHtml()) {
check.getCheckSteps().add(new ExtractHtmlContentAction(processor, outputDirectory));
Expand Down Expand Up @@ -235,7 +235,7 @@ private static void reportConfiguration(final Configuration configuration) {

}

private static NamingStrategy determineNamingStrategy(final CommandLineOptions.CliOptions cmd) {
private static NamingStrategy determineNamingStrategy(final CliOptions cmd) {
final DefaultNamingStrategy namingStrategy = new DefaultNamingStrategy();
if (isNotEmpty(cmd.getReportPrefix())) {
namingStrategy.setPrefix(cmd.getReportPrefix());
Expand All @@ -256,7 +256,7 @@ private static Assertions loadAssertions(final Path p) {
return a;
}

private static Path determineOutputDirectory(final CommandLineOptions.CliOptions cmd) {
private static Path determineOutputDirectory(final CliOptions cmd) {
final Path dir;
if (cmd.getOutputPath() != null) {
dir = cmd.getOutputPath();
Expand All @@ -269,7 +269,7 @@ private static Path determineOutputDirectory(final CommandLineOptions.CliOptions
return dir;
}

private static Collection<Input> determineTestTargets(final CommandLineOptions.CliOptions cmd) throws IOException {
private static Collection<Input> determineTestTargets(final CliOptions cmd) throws IOException {
final Collection<Input> targets = new ArrayList<>();
if (cmd.getFiles() != null && !cmd.getFiles().isEmpty()) {
cmd.getFiles().forEach(e -> targets.addAll(determineTestTarget(e)));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ private void extractNamespaces() {
final Iterable<String> iterable = () -> iterator;
StreamSupport.stream(iterable.spliterator(), false).filter(e -> !ArrayUtils.contains(IGNORED_PREFIXES, e))
.filter(StringUtils::isNotBlank).forEach(e -> ns.put(e, this.executable.getUnderlyingExpression().getInternalExpression()
.getRetainedStaticContext().getURIForPrefix(e, false)));
.getRetainedStaticContext().getURIForPrefix(e, false).toString()));
getNamespaces().putAll(ns);

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@
import java.util.Collection;
import java.util.StringJoiner;

import javax.xml.bind.ValidationEvent;
import javax.xml.bind.ValidationEventHandler;
import jakarta.xml.bind.ValidationEvent;
import jakarta.xml.bind.ValidationEventHandler;

import javax.xml.transform.ErrorListener;
import javax.xml.transform.SourceLocator;
import javax.xml.transform.TransformerException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,11 @@
import javax.xml.transform.stream.StreamSource;
import javax.xml.validation.Schema;
import javax.xml.validation.SchemaFactory;

import net.sf.saxon.lib.UnparsedTextURIResolver;
import net.sf.saxon.s9api.Processor;
import net.sf.saxon.s9api.SaxonApiException;
import net.sf.saxon.s9api.XsltCompiler;
import net.sf.saxon.s9api.XsltExecutable;
import org.apache.commons.lang3.StringUtils;
import org.xml.sax.SAXException;

Expand All @@ -50,13 +54,8 @@
import de.kosit.validationtool.model.scenarios.ScenarioType;
import de.kosit.validationtool.model.scenarios.ValidateWithSchematron;

import net.sf.saxon.lib.UnparsedTextURIResolver;
import net.sf.saxon.s9api.Processor;
import net.sf.saxon.s9api.SaxonApiException;
import net.sf.saxon.s9api.XPathCompiler;
import net.sf.saxon.s9api.XPathExecutable;
import net.sf.saxon.s9api.XsltCompiler;
import net.sf.saxon.s9api.XsltExecutable;

/**
* Repository für verschiedene XML Artefakte zur Vearbeitung der Prüfszenarien.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@
import java.util.Collection;
import java.util.StringJoiner;

import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBElement;
import javax.xml.bind.JAXBException;
import javax.xml.bind.JAXBIntrospector;
import javax.xml.bind.Marshaller;
import javax.xml.bind.Unmarshaller;
import javax.xml.bind.ValidationEventHandler;
import javax.xml.bind.annotation.XmlRegistry;
import jakarta.xml.bind.JAXBContext;
import jakarta.xml.bind.JAXBElement;
import jakarta.xml.bind.JAXBException;
import jakarta.xml.bind.JAXBIntrospector;
import jakarta.xml.bind.Marshaller;
import jakarta.xml.bind.Unmarshaller;
import jakarta.xml.bind.ValidationEventHandler;
import jakarta.xml.bind.annotation.XmlRegistry;
import javax.xml.namespace.QName;
import javax.xml.stream.XMLInputFactory;
import javax.xml.stream.XMLOutputFactory;
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/de/kosit/validationtool/impl/DefaultCheck.java
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,11 @@ protected boolean isSuccessful(final Map<String, Result> results) {

@Override
public Result checkInput(final Input input) {
final CheckAction.Bag t = new CheckAction.Bag(input, createReport());
final Bag t = new Bag(input, createReport());
return runCheckInternal(t);
}

protected Result runCheckInternal(final CheckAction.Bag t) {
protected Result runCheckInternal(final Bag t) {
final long started = System.currentTimeMillis();
log.info("Checking content of {}", t.getInput().getName());
for (final CheckAction action : this.checkSteps) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import java.io.IOException;
import java.nio.charset.Charset;

import javax.xml.bind.util.JAXBSource;
import jakarta.xml.bind.util.JAXBSource;
import javax.xml.transform.Source;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamSource;
Expand All @@ -42,7 +42,7 @@
* This class is known to work with:
* <ul>
* <li>{@link StreamSource} - both {@link java.io.InputStream} based and {@link java.io.Reader} based</li>
* <li>{@link javax.xml.transform.dom.DOMSource}</li>
* <li>{@link DOMSource}</li>
* <li>{@link javax.xml.bind.util.JAXBSource}</li>
* <li>{@link TreeInfo}</li>
* </ul>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ private static class CountInputStream extends FilterInputStream {
private final LazyReadInput reference;

public CountInputStream(final LazyReadInput input, final InputStream stream) {
super(new org.apache.commons.io.input.CountingInputStream(stream));
super(new CountingInputStream(stream));
this.reference = input;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
import java.util.Collection;
import java.util.stream.Collectors;

import javax.xml.bind.JAXBException;
import javax.xml.bind.Marshaller;
import javax.xml.bind.util.JAXBSource;
import jakarta.xml.bind.JAXBException;
import jakarta.xml.bind.Marshaller;
import jakarta.xml.bind.util.JAXBSource;

import org.xml.sax.ContentHandler;
import org.xml.sax.DTDHandler;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ private ValidationResultsSchematron validate(final Scenario scenario, final Bag
// resolving nur relative zum Repository
transformer.setURIResolver(scenario.getUriResolver());
final CollectingErrorEventHandler e = new CollectingErrorEventHandler();
transformer.setMessageListener(e);
transformer.setErrorListener(e);

final XdmDestination result = new XdmDestination();
transformer.setDestination(result);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

package de.kosit.validationtool.impl.xml;

import javax.xml.bind.annotation.adapters.XmlAdapter;
import jakarta.xml.bind.annotation.adapters.XmlAdapter;

public class StringTrimAdapter extends XmlAdapter<String, String> {

Expand Down
4 changes: 1 addition & 3 deletions src/main/resources/app-info.properties
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,5 @@
project_version=${project.version}
framework_version=1.0.2
engine_name=KoSIT Validator
build_timestamp=${build.timestamp}
build_number=${build.number}
build_revision=${build.revision}
build_branch=${build.branch}

Loading