diff --git a/.gitignore b/.gitignore index a70a722..23b183e 100644 --- a/.gitignore +++ b/.gitignore @@ -36,6 +36,7 @@ src/generated .factorypath .idea/ .settings/ +.externalToolBuilders/ .vscode *.code-workspace *.xpr @@ -46,3 +47,9 @@ xrechnung .DS_Store andre*-simple.xml somePrefix*.xml +zz + +# 2.0 stuff +api/ +cli/ +core/ diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 686bdd9..75032c2 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,8 +1,8 @@ image: maven:latest - + variables: BUILD_PROPS: "-Dbuild.revision=$CI_COMMIT_SHA -Dbuild.branch=$CI_COMMIT_REF_NAME -Dbuild.number=$CI_PIPELINE_IID -Dfile.encoding=UTF-8 -Dhttp.keepAlive=false -Dmaven.wagon.http.pool=false" - MAVEN_OPTS: "-Dmaven.repo.local=$CI_PROJECT_DIR/.m2/repository -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=WARN -Dorg.slf4j.simpleLogger.showDateTime=true -Djava.awt.headless=true" + MAVEN_OPTS: "-Dmaven.repo.local=$CI_PROJECT_DIR/.m2/repository -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=WARN -Dorg.slf4j.simpleLogger.showDateTime=true -Djava.awt.headless=true -Xmx6g" MAVEN_CLI_OPTS: " --batch-mode --update-snapshots --errors --fail-at-end --show-version -s .mvn/settings.xml" MAVEN_CLI_OPTS_CENTRAL: " --batch-mode --show-version -s .mvn/settings-maven-central.xml" @@ -15,6 +15,7 @@ cache: paths: - .m2/repository +# Basic Java build steps .java: stage: build needs: @@ -32,11 +33,6 @@ cache: - target/surefire-reports/*.xml - target/failsafe-reports/*.xml -.java_extended: - extends: .java - rules: - - if: $CI_PIPELINE_SOURCE == "schedule" - java-11: extends: .java image: maven:3-eclipse-temurin-11-alpine @@ -54,10 +50,6 @@ java-11: - target/surefire-reports/*.xml - target/failsafe-reports/*.xml -java-11-openj9: - extends: .java_extended - image: maven:3-jdk-11-openj9 - java-17: extends: .java image: maven:3-eclipse-temurin-17-alpine @@ -66,14 +58,29 @@ java-21: extends: .java image: maven:3-eclipse-temurin-21-alpine -java-24: - extends: .java_extended - image: maven:3-eclipse-temurin-24-alpine - java-25: extends: .java image: maven:3-eclipse-temurin-25-alpine - + +# Rare Java stuff +.java_extended: + extends: .java + rules: + - if: $CI_PIPELINE_SOURCE == "schedule" + +# Note: the openj9 images don't exist for Java 17, 21 or 25 +# Removed because the latest public image is 11.0.11 which is not comaptible to the Lombok requirement of 11.0.23 +#java-11-openj9: +# extends: .java_extended +# image: maven:3-jdk-11-openj9 + +# Deploy Java 11 build on Maven Central +deploy-java-11-snapshot: + extends: java-11 + script: + - mvn $MAVEN_CLI_OPTS_CENTRAL -P release-snapshot deploy + +# Deploy Java 11 build to KoSIT repository (manually) deploy: stage: deploy image: maven:3-eclipse-temurin-11-alpine @@ -81,18 +88,14 @@ deploy: - job: java-11 script: - export PROJECT_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout) - - mvn $MAVEN_CLI_OPTS deploy:deploy-file -Dfile=target/validator-${PROJECT_VERSION}.zip -DgroupId=kosit -DartifactId=validator -Dclassifier="distribution" -Dversion=${PROJECT_VERSION} -Dpackaging=zip -DrepositoryId="gitlab-maven" -Durl=https://projekte.kosit.org/api/v4/projects/7/packages/maven - - mvn $MAVEN_CLI_OPTS deploy:deploy-file -Dfile=target/validator-${PROJECT_VERSION}.jar -DgroupId=kosit -DartifactId=validator -Dversion=${PROJECT_VERSION} -Dpackaging=jar -DrepositoryId="gitlab-maven" -Durl=https://projekte.kosit.org/api/v4/projects/7/packages/maven - - mvn $MAVEN_CLI_OPTS deploy:deploy-file -Dfile=target/validator-${PROJECT_VERSION}-javadoc.jar -DgroupId=kosit -DartifactId=validator -Dclassifier="javadoc" -Dversion=${PROJECT_VERSION} -Dpackaging=zip -DrepositoryId="gitlab-maven" -Durl=https://projekte.kosit.org/api/v4/projects/7/packages/maven - - mvn $MAVEN_CLI_OPTS deploy:deploy-file -Dfile=target/validator-${PROJECT_VERSION}-standalone.jar -DgroupId=kosit -DartifactId=validator -Dclassifier="standalone" -Dversion=${PROJECT_VERSION} -Dpackaging=jar -DrepositoryId="gitlab-maven" -Durl=https://projekte.kosit.org/api/v4/projects/7/packages/maven - - mvn $MAVEN_CLI_OPTS deploy:deploy-file -Dfile=target/validator-${PROJECT_VERSION}-sources.jar -DgroupId=kosit -DartifactId=validator -Dclassifier="sources" -Dversion=${PROJECT_VERSION} -Dpackaging=jar -DrepositoryId="gitlab-maven" -Durl=https://projekte.kosit.org/api/v4/projects/7/packages/maven + - mvn $MAVEN_CLI_OPTS deploy:deploy-file -Dfile=target/validator-${PROJECT_VERSION}.zip -DgroupId=kosit -DartifactId=validator -Dversion=${PROJECT_VERSION} -Dclassifier="distribution" -Dpackaging=zip -DrepositoryId="gitlab-maven" -Durl=https://projekte.kosit.org/api/v4/projects/7/packages/maven + - mvn $MAVEN_CLI_OPTS deploy:deploy-file -Dfile=target/validator-${PROJECT_VERSION}.jar -DgroupId=kosit -DartifactId=validator -Dversion=${PROJECT_VERSION} -Dpackaging=jar -DrepositoryId="gitlab-maven" -Durl=https://projekte.kosit.org/api/v4/projects/7/packages/maven + - mvn $MAVEN_CLI_OPTS deploy:deploy-file -Dfile=target/validator-${PROJECT_VERSION}-javadoc.jar -DgroupId=kosit -DartifactId=validator -Dversion=${PROJECT_VERSION} -Dclassifier="javadoc" -Dpackaging=zip -DrepositoryId="gitlab-maven" -Durl=https://projekte.kosit.org/api/v4/projects/7/packages/maven + - mvn $MAVEN_CLI_OPTS deploy:deploy-file -Dfile=target/validator-${PROJECT_VERSION}-standalone.jar -DgroupId=kosit -DartifactId=validator -Dversion=${PROJECT_VERSION} -Dclassifier="standalone" -Dpackaging=jar -DrepositoryId="gitlab-maven" -Durl=https://projekte.kosit.org/api/v4/projects/7/packages/maven + - mvn $MAVEN_CLI_OPTS deploy:deploy-file -Dfile=target/validator-${PROJECT_VERSION}-sources.jar -DgroupId=kosit -DartifactId=validator -Dversion=${PROJECT_VERSION} -Dclassifier="sources" -Dpackaging=jar -DrepositoryId="gitlab-maven" -Durl=https://projekte.kosit.org/api/v4/projects/7/packages/maven when: manual -deploy-snapshot: - extends: java-11 - script: - - mvn $MAVEN_CLI_OPTS_CENTRAL -P release-snapshot deploy - +# Build Docker images and upload to KoSIT registry create-build-image: stage: deploy image: docker:latest @@ -108,12 +111,22 @@ create-build-image: changes: - .mvn/createBuildImages.sh +# Run OWASP checks - expensive so only on main branch owasp-check: - extends: .java + stage: test image: maven:3-eclipse-temurin-21-alpine needs: [ ] + # set job timeout to 1 hour - it's required when new rules are downloaded + timeout: 1h + variables: + RUNNER_SCRIPT_TIMEOUT: 1h script: - mvn $MAVEN_CLI_OPTS $BUILD_PROPS $CI_JOB_TIMESTAMP validate -Powasp-check + artifacts: + name: artifacts + reports: + codequality: + - target/dependency-check-report.html rules: - if: $CI_PIPELINE_SOURCE == "schedule" - if: $CI_COMMIT_REF_NAME == "main" diff --git a/CHANGELOG.md b/CHANGELOG.md index ef56bf3..802455f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,8 +6,21 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## Unreleased +## 1.6.2 - 2026-02-17 +### Changed + +- (BUILD) [GitHub #173]( https://github.com/itplr-kosit/validator/issues/173) The JAR files now contain details on the used third-party component licenses. Thanks to @cech12 +- (BUILD) [GitHub #169](https://github.com/itplr-kosit/validator/issues/169) The `.zip` file created from `maven-assembly-plugin` now contains the correct xml-resolver dependencies. Thanks to @landrix for pointing that out +- (BUILD) [#179](https://projekte.kosit.org/kosit/validator/-/issues/179) Updated all dependencies to the latest suitable versions + +## 1.6.1 - 2026-02-05 + +### Changed + +- (CORE) [#106](https://projekte.kosit.org/kosit/validator/-/issues/106) The `match` element in `scenarios.xml` is required to have at least one character (per XSD change) +- (BUILD) [#176](https://projekte.kosit.org/kosit/validator/-/issues/176) The Maven Central deployed `pom.xml` properly includes runtime dependencies +- (BUILD) [#175](https://projekte.kosit.org/kosit/validator/-/issues/175) The `.zip` file created from `maven-assembly-plugin` no longer contains the standalone validator, which reduces its size to 50% ## 1.6.0 - 2025-11-07 diff --git a/NOTICE b/NOTICE index a1ed12f..669ba21 100644 --- a/NOTICE +++ b/NOTICE @@ -1,5 +1,29 @@ KoSIT XML Validator -Copyright 2017-2025 Koordinierungsstelle für IT-Standards (KoSIT) +Copyright 2017-2026 Koordinierungsstelle für IT-Standards (KoSIT) This product includes software developed by Koordinierungsstelle für IT-Standards (). + +This product includes software developed at +The Apache Software Foundation (http://www.apache.org/). +Licensed under Apache 2.0 + +This product includes software developed at +Fusesource (http://fusesource.github.io/jansi/). +Licensed under Apache 2.0 + +This product includes software developed at +Remko Popma (https://picocli.info/). +Licensed under Apache 2.0 + +This product includes software developed at +Saxonica (https://github.com/Saxonica/Saxon-HE). +Licensed under MPL 2.0 + +This product includes software developed at +Eclipse Foundation (https://github.com/eclipse-ee4j/jaxb-ri). +Licensed under EDL 1.0 + +This product includes software developed at +QOS.ch (https://www.slf4j.org/). +Licensed under MIT diff --git a/pom.xml b/pom.xml index 5d04818..8a3e450 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ org.kosit validator - 1.6.1-SNAPSHOT + 1.6.3-SNAPSHOT KoSIT XML Validator against XSD and Schematron based on defined scenarios. @@ -38,17 +38,18 @@ UTF-8 - 3.27.3 - 2.20.0 - 3.18.0 + 3.27.7 + 2.21.0 + 3.20.0 0.8.13 - 4.0.2 - 4.0.5 + 4.0.4 + 4.0.6 1.18.42 - 4.11.0 + 5.21.0 12.1.8 - 5.5.5 - 12.8 + + 5.5.7 + 12.9 2.0.17 4.0.11 @@ -80,17 +81,16 @@ ${version.lombok} provided - - net.sf.saxon - Saxon-HE - ${version.saxon-he} - compile - org.slf4j slf4j-api ${version.slf4j} + + net.sf.saxon + Saxon-HE + ${version.saxon-he} + info.picocli picocli @@ -180,7 +180,7 @@ org.sonatype.central central-publishing-maven-plugin - 0.8.0 + 0.10.0 true central @@ -206,6 +206,33 @@ + + + maven-resources-plugin + 3.4.0 + + + copy-license-notice + process-resources + + copy-resources + + + ${project.build.outputDirectory}/META-INF + + + ${project.basedir} + + NOTICE + + + + true + + + + + org.codehaus.mojo build-helper-maven-plugin @@ -275,29 +302,54 @@ org.apache.maven.plugins maven-shade-plugin - 3.6.0 + 3.6.1 - jdk11+ package shade + false true standalone de.kosit.validationtool.cmd.CommandLineApplication + + + + + + + false + *:* + + META-INF/*.MF + META-INF/*.SF META-INF/*.DSA META-INF/*.RSA + **/module-info.class @@ -626,7 +678,8 @@ ${project.basedir}/owasp-suppressions.xml - + + ${NVD_API_KEY} diff --git a/src/assembly/assembly-dist.xml b/src/assembly/assembly-dist.xml index 597eec6..5d27120 100644 --- a/src/assembly/assembly-dist.xml +++ b/src/assembly/assembly-dist.xml @@ -20,6 +20,10 @@ validator-*.jar + + + *standalone.jar + @@ -28,7 +32,6 @@ libs false runtime - ${artifact.artifactId}-${artifact.baseVersion}.${artifact.extension} diff --git a/src/main/java/de/kosit/validationtool/impl/CollectingErrorEventHandler.java b/src/main/java/de/kosit/validationtool/impl/CollectingErrorEventHandler.java index be10111..042dd95 100644 --- a/src/main/java/de/kosit/validationtool/impl/CollectingErrorEventHandler.java +++ b/src/main/java/de/kosit/validationtool/impl/CollectingErrorEventHandler.java @@ -47,7 +47,7 @@ public class CollectingErrorEventHandler implements ValidationEventHandler, Erro private static final int DEFAULT_ABORT_COUNT = 50; - private static final int stopProcessCount = DEFAULT_ABORT_COUNT; + private final int stopProcessCount = DEFAULT_ABORT_COUNT; private final List errors = new ArrayList<>(); diff --git a/src/main/java/de/kosit/validationtool/impl/tasks/SchematronValidationAction.java b/src/main/java/de/kosit/validationtool/impl/tasks/SchematronValidationAction.java index ae85023..90ad899 100644 --- a/src/main/java/de/kosit/validationtool/impl/tasks/SchematronValidationAction.java +++ b/src/main/java/de/kosit/validationtool/impl/tasks/SchematronValidationAction.java @@ -23,9 +23,6 @@ import javax.xml.transform.dom.DOMSource; import org.oclc.purl.dsdl.svrl.SchematronOutput; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; - import de.kosit.validationtool.impl.CollectingErrorEventHandler; import de.kosit.validationtool.impl.ConversionService; import de.kosit.validationtool.impl.Scenario; @@ -33,7 +30,8 @@ import de.kosit.validationtool.impl.Scenario.Transformation; import de.kosit.validationtool.model.reportInput.CreateReportInput; import de.kosit.validationtool.model.reportInput.ValidationResultsSchematron; import de.kosit.validationtool.model.reportInput.ValidationResultsSchematron.Results; - +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; import net.sf.saxon.dom.NodeOverNodeInfo; import net.sf.saxon.s9api.SaxonApiException; import net.sf.saxon.s9api.XdmDestination; @@ -71,6 +69,11 @@ public class SchematronValidationAction implements CheckAction { transformer.setInitialContextNode(document); transformer.transform(); + // If we reach this line, it means no Exception was thrown :-) + if (e.hasErrors()) { + log.error("XSLT errors found: " + e.getErrorDescription()); + } + final ValidationResultsSchematron.Results r = new ValidationResultsSchematron.Results(); r.setSchematronOutput(this.conversionService.readDocument( new DOMSource(NodeOverNodeInfo.wrap(result.getXdmNode().getUnderlyingNode()).getOwnerDocument()), diff --git a/src/main/java/de/kosit/validationtool/impl/xml/StringTrimAdapter.java b/src/main/java/de/kosit/validationtool/impl/xml/StringTrimAdapter.java index 08ef4b1..ca839dd 100644 --- a/src/main/java/de/kosit/validationtool/impl/xml/StringTrimAdapter.java +++ b/src/main/java/de/kosit/validationtool/impl/xml/StringTrimAdapter.java @@ -22,18 +22,12 @@ public class StringTrimAdapter extends XmlAdapter { @Override public String unmarshal(final String v) { - if (v == null) { - return null; - } - return v.trim(); + return trim(v); } @Override public String marshal(final String v) { - if (v == null) { - return null; - } - return v.trim(); + return trim(v); } public static String trim(final String v) { diff --git a/src/main/model/binding/global.xjb b/src/main/model/binding/global.xjb index cd2a512..ae2d603 100644 --- a/src/main/model/binding/global.xjb +++ b/src/main/model/binding/global.xjb @@ -1,6 +1,6 @@ - - @@ -72,13 +55,19 @@ + + + + + + - + @@ -138,3 +127,18 @@ + diff --git a/src/main/resources/LICENSE.validator b/src/main/resources/LICENSE.validator new file mode 100644 index 0000000..d9a10c0 --- /dev/null +++ b/src/main/resources/LICENSE.validator @@ -0,0 +1,176 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS diff --git a/src/main/resources/app-info.properties b/src/main/resources/app-info.properties index d8e3ace..fa6be89 100644 --- a/src/main/resources/app-info.properties +++ b/src/main/resources/app-info.properties @@ -1,5 +1,5 @@ # -# Copyright 2017-2022 Koordinierungsstelle für IT-Standards (KoSIT) +# Copyright 2017-2026 Koordinierungsstelle für IT-Standards (KoSIT) # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/src/main/resources/simplelogger.properties b/src/main/resources/simplelogger.properties index cd77b47..66281f8 100644 --- a/src/main/resources/simplelogger.properties +++ b/src/main/resources/simplelogger.properties @@ -1,5 +1,5 @@ # -# Copyright 2017-2022 Koordinierungsstelle für IT-Standards (KoSIT) +# Copyright 2017-2026 Koordinierungsstelle für IT-Standards (KoSIT) # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -32,21 +32,3 @@ org.slf4j.simpleLogger.showLogName=false # Defaults to false. org.slf4j.simpleLogger.showShortLogName=false org.slf4j.simpleLogger.levelInBrackets=true -# -# Licensed to the Koordinierungsstelle f�r IT-Standards (KoSIT) under -# one or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. KoSIT licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# diff --git a/src/main/resources/transform/identity.xsl b/src/main/resources/transform/identity.xsl index fc4ff01..4ddc79e 100644 --- a/src/main/resources/transform/identity.xsl +++ b/src/main/resources/transform/identity.xsl @@ -1,5 +1,6 @@ + - @@ -24,5 +24,4 @@ - - \ No newline at end of file + diff --git a/src/test/java/de/kosit/validationtool/cmd/CommandlineApplicationTest.java b/src/test/java/de/kosit/validationtool/cmd/CommandlineApplicationTest.java index b9b2ed8..dce14d4 100644 --- a/src/test/java/de/kosit/validationtool/cmd/CommandlineApplicationTest.java +++ b/src/test/java/de/kosit/validationtool/cmd/CommandlineApplicationTest.java @@ -139,6 +139,15 @@ public class CommandlineApplicationTest { assertThat(CommandLine.getErrorOutput()).contains(RESULT_OUTPUT); } + @Test + public void testValidMinimalConfigurationXSLTRuntimeError() { + final String[] args = { "-s", Paths.get(Simple.SCENARIOS_XSLT_RUNTIME_ERROR).toString(), "-h", "-o", + this.output.toAbsolutePath().toString(), "--serialize-report-input", + Paths.get(Simple.SIMPLE_XSLT_RUNTIME_ERROR).toString() }; + CommandLineApplication.mainProgram(args); + assertThat(CommandLine.getErrorOutput()).contains(RESULT_OUTPUT); + } + @Test public void testValidNamingConfiguration() { final String[] args = { "-s", Paths.get(Simple.SCENARIOS).toString(), "-r", Paths.get(Simple.REPOSITORY_URI).toString(), @@ -159,7 +168,7 @@ public class CommandlineApplicationTest { @Test public void testValidDirectoryInput() { final String[] args = { "-s", Paths.get(Simple.SCENARIOS).toString(), "-o", this.output.toString(), "-r", - Paths.get(Simple.REPOSITORY_URI).toString(), Paths.get(Simple.EXAMPLES).toString() }; + Paths.get(Simple.REPOSITORY_URI).toString(), Paths.get(Simple.INPUT).toString() }; CommandLineApplication.mainProgram(args); assertThat(CommandLine.getErrorOutput()).contains("Processing 9 object(s) completed"); } diff --git a/src/test/java/de/kosit/validationtool/impl/Helper.java b/src/test/java/de/kosit/validationtool/impl/Helper.java index 00da5a3..25d6158 100644 --- a/src/test/java/de/kosit/validationtool/impl/Helper.java +++ b/src/test/java/de/kosit/validationtool/impl/Helper.java @@ -49,15 +49,18 @@ public class Helper { public static final URI ROOT = EXAMPLES_DIR.resolve("simple/"); - public static final URI EXAMPLES = ROOT.resolve("input/"); + public static final URI INPUT = ROOT.resolve("input/"); public static final URI SIMPLE_VALID = ROOT.resolve("input/simple.xml"); + public static final URI SIMPLE_XSLT_RUNTIME_ERROR = EXAMPLES_DIR + .resolve("invalid/xslt-runtime-error/input/simple-xslt-runtime-error.xml"); + public static final URI FOO = ROOT.resolve("input/foo.xml"); - public static final URI FOO_SCHEMATRON_INVALID = EXAMPLES.resolve("foo-schematron-invalid.xml"); + public static final URI FOO_SCHEMATRON_INVALID = INPUT.resolve("foo-schematron-invalid.xml"); - public static final URI FOO_CUSTOM_LEVEL_ERROR = EXAMPLES.resolve("foo-custom-level-error.xml"); + public static final URI FOO_CUSTOM_LEVEL_ERROR = INPUT.resolve("foo-custom-level-error.xml"); public static final URI REJECTED = ROOT.resolve("input/withManualReject.xml"); @@ -65,6 +68,9 @@ public class Helper { public static final URI SCENARIOS_WITH_RELATIVE_PATHS = ROOT.resolve("scenarios-with-relative-paths.xml"); + public static final URI SCENARIOS_XSLT_RUNTIME_ERROR = EXAMPLES_DIR + .resolve("invalid/xslt-runtime-error/scenarios-with-xslt-runtime-error.xml"); + public static final URI OTHER_SCENARIOS = ROOT.resolve("otherScenarios.xml"); public static final URI ERROR_SCENARIOS = ROOT.resolve("scenarios-with-errors.xml"); @@ -101,6 +107,7 @@ public class Helper { public static class Invalid { + // Is the typo in the name on purpose??? public static final URI ROOT = EXAMPLES_DIR.resolve("invaid/"); public static final URI SCENARIOS = ROOT.resolve("scenarios.xml"); diff --git a/src/test/resources/examples/invalid/xslt-runtime-error/input/simple-xslt-runtime-error.xml b/src/test/resources/examples/invalid/xslt-runtime-error/input/simple-xslt-runtime-error.xml new file mode 100644 index 0000000..cdbd1cf --- /dev/null +++ b/src/test/resources/examples/invalid/xslt-runtime-error/input/simple-xslt-runtime-error.xml @@ -0,0 +1,23 @@ + + + abc + def + + + + + diff --git a/src/test/resources/examples/invalid/xslt-runtime-error/repository/report.xsl b/src/test/resources/examples/invalid/xslt-runtime-error/repository/report.xsl new file mode 100644 index 0000000..6eb7471 --- /dev/null +++ b/src/test/resources/examples/invalid/xslt-runtime-error/repository/report.xsl @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/test/resources/examples/invalid/xslt-runtime-error/repository/simple-xslt-runtime-error.xsl b/src/test/resources/examples/invalid/xslt-runtime-error/repository/simple-xslt-runtime-error.xsl new file mode 100644 index 0000000..8a8f0de --- /dev/null +++ b/src/test/resources/examples/invalid/xslt-runtime-error/repository/simple-xslt-runtime-error.xsl @@ -0,0 +1,231 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + / + + + + + + *: + + [namespace-uri()=' + + '] + + + + [ + + ] + + + + / + + @ + + + @*[local-name()=' + + ' and namespace-uri()=' + + '] + + + + + + + + + / + + + [ + + ] + + + + /@ + + + + + + + / + + + [ + + ] + + + + /@ + + + + + + + + + + + + + + + + + + + + + + + + . + + + + + U + + U + + + + U. + + n + + + + U. + + _ + + _ + + + + + + + + + +   +   +   + + + + + + + + + + + + + + + + Schematron Simple + + + + + + + + + + + + + + content-2 + + + + The decimal value of s:inner should be 1. + + + + + + + + + + + + diff --git a/src/test/resources/examples/invalid/xslt-runtime-error/repository/simple.xsd b/src/test/resources/examples/invalid/xslt-runtime-error/repository/simple.xsd new file mode 100644 index 0000000..04d5923 --- /dev/null +++ b/src/test/resources/examples/invalid/xslt-runtime-error/repository/simple.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/test/resources/examples/invalid/xslt-runtime-error/scenarios-with-xslt-runtime-error.xml b/src/test/resources/examples/invalid/xslt-runtime-error/scenarios-with-xslt-runtime-error.xml new file mode 100644 index 0000000..f1c13a6 --- /dev/null +++ b/src/test/resources/examples/invalid/xslt-runtime-error/scenarios-with-xslt-runtime-error.xml @@ -0,0 +1,61 @@ + + + XSLT-Runtime-Error-TestSuite + QA + 2026-03-02 + +

Szenario für Tests

+
+ + + Simple + +

Teste Fehlerfall.

+
+ http://www.xoev.de/de/validator/framework/1/createreportinput + http://validator.kosit.de/test-sample + http://validator.kosit.de/test-report + / + + + + Sample Schema + repository/simple.xsd + + + + + Sample Schematron + repository/simple-xslt-runtime-error.xsl + + + + + Report für eRechnung + repository/report.xsl + + +
+ + + + default + repository/report.xsl + + +
+