Compare commits

2 Commits

Author SHA1 Message Date
Louis DEVIE
a44b175a6d workflow gitea
Some checks failed
Java CI with Maven / build (push) Failing after 1m34s
2026-06-25 10:55:04 +02:00
aff4f5080d adaptation du projet library en java8
Some checks failed
Java CI with Maven / build (push) Has been cancelled
2026-06-03 23:15:37 +02:00
19 changed files with 74 additions and 57 deletions

View File

@@ -0,0 +1,22 @@
# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
# For setup-java see: https://github.com/actions/setup-java#Usage
name: Java CI with Maven
on: [push, pull_request]
jobs:
build:
runs-on: self-hosted
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v3 # the log states the default ~/.m2/toolchains.xml is being created pointing to the JDK
with:
distribution: 'adopt' # for latest JDKs use temurin https://blog.adoptopenjdk.net/2021/08/goodbye-adoptopenjdk-hello-adoptium/
java-version: '11'
cache: 'maven' #cache/restore any dependencies to improve the workflow execution time
- name: Build with Maven
run: mvn -B package --file pom.xml

View File

@@ -44,7 +44,7 @@
<github.global.server>github</github.global.server> <github.global.server>github</github.global.server>
<additionalparam>-Xdoclint:none</additionalparam> <additionalparam>-Xdoclint:none</additionalparam>
<!-- Skip error check for javadoc --> <!-- Skip error check for javadoc -->
<maven.compiler.release>11</maven.compiler.release> <maven.compiler.release>8</maven.compiler.release>
<maven.deploy.skip>true</maven.deploy.skip><!-- do deploy to maven central, parent project does not and inherits --> <maven.deploy.skip>true</maven.deploy.skip><!-- do deploy to maven central, parent project does not and inherits -->
</properties> </properties>
<dependencies> <dependencies>
@@ -169,8 +169,8 @@
<!-- http://stackoverflow.com/questions/574594/how-can-i-create-an-executable-jar-with-dependencies-using-maven <!-- http://stackoverflow.com/questions/574594/how-can-i-create-an-executable-jar-with-dependencies-using-maven
mvn clean compile assembly:single --> mvn clean compile assembly:single -->
<!-- or whatever version you use --> <!-- or whatever version you use -->
<source>11</source> <source>8</source>
<target>11</target> <target>8</target>
</configuration> </configuration>
</plugin> </plugin>
<plugin> <plugin>
@@ -331,7 +331,7 @@
<configuration> <configuration>
<toolchains> <toolchains>
<jdk> <jdk>
<version>11</version> <version>8</version>
<vendor>adopt</vendor> <vendor>adopt</vendor>
</jdk> </jdk>
</toolchains> </toolchains>

View File

@@ -5,6 +5,9 @@ import com.fasterxml.jackson.annotation.JsonInclude;
import org.mustangproject.ZUGFeRD.IZUGFeRDExportableContact; import org.mustangproject.ZUGFeRD.IZUGFeRDExportableContact;
import org.w3c.dom.Node; import org.w3c.dom.Node;
import org.w3c.dom.NodeList; import org.w3c.dom.NodeList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set; import java.util.Set;
/*** /***
@@ -115,7 +118,7 @@ public class Contact implements IZUGFeRDExportableContact {
String localName = currentItemNode.getLocalName(); String localName = currentItemNode.getLocalName();
if (localName != null) { if (localName != null) {
Set<String> nameElements = Set.of("PersonName"/*CII*/, "Name"/*UBL*/); Set<String> nameElements = new HashSet<>(Arrays.asList("PersonName"/*CII*/, "Name"/*UBL*/));
if (localName != null && nameElements.contains(localName) if (localName != null && nameElements.contains(localName)
&& currentItemNode.getFirstChild()!=null) { && currentItemNode.getFirstChild()!=null) {
setName(currentItemNode.getFirstChild().getNodeValue()); setName(currentItemNode.getFirstChild().getNodeValue());

View File

@@ -335,7 +335,7 @@ public class Item implements IZUGFeRDExportableItem {
return this; return this;
} }
@Deprecated(since = "2.14.0") @Deprecated()
public Item addReferencedLineID(String s) { public Item addReferencedLineID(String s) {
return addBuyerOrderReferencedDocumentLineID(s); return addBuyerOrderReferencedDocumentLineID(s);
} }

View File

@@ -1,8 +1,6 @@
package org.mustangproject; package org.mustangproject;
import java.util.ArrayList; import java.util.*;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.stream.Stream; import java.util.stream.Stream;
@@ -163,7 +161,7 @@ public class TradeParty implements IZUGFeRDExportableTradeParty {
NodeList taxSchemechilds = partyTaxScheme.item(partyTaxSchemeIndex).getChildNodes(); NodeList taxSchemechilds = partyTaxScheme.item(partyTaxSchemeIndex).getChildNodes();
for (int taxSchemechildsIndex = 0; taxSchemechildsIndex < taxSchemechilds.getLength(); taxSchemechildsIndex++) { for (int taxSchemechildsIndex = 0; taxSchemechildsIndex < taxSchemechilds.getLength(); taxSchemechildsIndex++) {
if (taxSchemechilds.item(taxSchemechildsIndex).getLocalName() != null) { if (taxSchemechilds.item(taxSchemechildsIndex).getLocalName() != null) {
Set<String> taxSchemeTypes = Set.of("FC", "NOVAT"); Set<String> taxSchemeTypes = new HashSet<>(Arrays.asList("FC", "NOVAT"));
String textContent = taxSchemechilds.item(taxSchemechildsIndex).getTextContent(); String textContent = taxSchemechilds.item(taxSchemechildsIndex).getTextContent();
if (textContent != null && taxSchemeTypes.contains(textContent)) { if (textContent != null && taxSchemeTypes.contains(textContent)) {
setTaxID(CompanyId); setTaxID(CompanyId);

View File

@@ -282,7 +282,7 @@ public class TransactionCalculator implements IAbsoluteValueProvider {
itemVATAmount.setVatExemptionReasonText(reasonText); itemVATAmount.setVatExemptionReasonText(reasonText);
} }
final Optional<VATAmount> currentVatAmount = this.getCurrentVatAmount(vatAmounts, currentItem.getProduct().getTaxCategoryCode(), percent); final Optional<VATAmount> currentVatAmount = this.getCurrentVatAmount(vatAmounts, currentItem.getProduct().getTaxCategoryCode(), percent);
if (currentVatAmount.isEmpty()) { if (!currentVatAmount.isPresent()) {
vatAmounts.add(itemVATAmount); vatAmounts.add(itemVATAmount);
} else { } else {
this.mergeAdding(currentVatAmount.get(), itemVATAmount); this.mergeAdding(currentVatAmount.get(), itemVATAmount);
@@ -299,7 +299,7 @@ public class TransactionCalculator implements IAbsoluteValueProvider {
final BigDecimal chargeBasis = currentCharge.getTotalAmount(this); final BigDecimal chargeBasis = currentCharge.getTotalAmount(this);
final VATAmount chargeVatAmount = new VATAmount(chargeBasis, chargeBasis.multiply(taxPercent.divide(new BigDecimal(100))), vatCategoryCode, final VATAmount chargeVatAmount = new VATAmount(chargeBasis, chargeBasis.multiply(taxPercent.divide(new BigDecimal(100))), vatCategoryCode,
vatDueDateTypeCode, taxPercent); vatDueDateTypeCode, taxPercent);
if (currentChargeVatAmount.isEmpty()) { if (!currentChargeVatAmount.isPresent()) {
vatAmounts.add(chargeVatAmount); vatAmounts.add(chargeVatAmount);
} else { } else {
this.mergeAdding(currentChargeVatAmount.get(), chargeVatAmount); this.mergeAdding(currentChargeVatAmount.get(), chargeVatAmount);
@@ -319,7 +319,7 @@ public class TransactionCalculator implements IAbsoluteValueProvider {
allowanceNegativeBasis.multiply(taxPercent.divide(new BigDecimal(100))), allowanceNegativeBasis.multiply(taxPercent.divide(new BigDecimal(100))),
currentAllowance.getCategoryCode() != null ? currentAllowance.getCategoryCode() : "S", currentAllowance.getCategoryCode() != null ? currentAllowance.getCategoryCode() : "S",
vatDueDateTypeCode, taxPercent); vatDueDateTypeCode, taxPercent);
if (currentAllowanceVatAmount.isEmpty()) { if (!currentAllowanceVatAmount.isPresent()) {
vatAmounts.add(allowanceVATAmount); vatAmounts.add(allowanceVATAmount);
} else { } else {
this.mergeAdding(currentAllowanceVatAmount.get(), allowanceVATAmount); this.mergeAdding(currentAllowanceVatAmount.get(), allowanceVATAmount);
@@ -333,10 +333,13 @@ public class TransactionCalculator implements IAbsoluteValueProvider {
public void mergeAdding(VATAmount vatAmount, VATAmount toAdd) { public void mergeAdding(VATAmount vatAmount, VATAmount toAdd) {
vatAmount.setBasis(vatAmount.getBasis().add(toAdd.getBasis())); vatAmount.setBasis(vatAmount.getBasis().add(toAdd.getBasis()));
vatAmount.setCalculated(vatAmount.getCalculated().add(toAdd.getCalculated())); vatAmount.setCalculated(vatAmount.getCalculated().add(toAdd.getCalculated()));
if (toAdd.getVatExemptionReasonText() != null && !toAdd.getVatExemptionReasonText().isBlank()) { if (toAdd.getVatExemptionReasonText() != null && !toAdd.getVatExemptionReasonText().trim().isEmpty()) {
Optional.ofNullable(vatAmount.getVatExemptionReasonText()).filter(reasonText -> !reasonText.equals(toAdd.getVatExemptionReasonText())).ifPresentOrElse( Optional<String> text = Optional.ofNullable(vatAmount.getVatExemptionReasonText()).filter(reasonText -> !reasonText.equals(toAdd.getVatExemptionReasonText()));
text -> vatAmount.setVatExemptionReasonText(String.join(", ", text, toAdd.getVatExemptionReasonText())), if (text.isPresent()) {
() -> vatAmount.setVatExemptionReasonText(toAdd.getVatExemptionReasonText())); vatAmount.setVatExemptionReasonText(String.join(", ", text.get(), toAdd.getVatExemptionReasonText()));
} else {
vatAmount.setVatExemptionReasonText(toAdd.getVatExemptionReasonText());
}
} }
} }

View File

@@ -76,7 +76,7 @@ public class ValidationLogVisualizer {
LOGGER.error("Failed to create PDF", e1); LOGGER.error("Failed to create PDF", e1);
} }
return baos.toString(StandardCharsets.UTF_8); return new String(baos.toByteArray(), StandardCharsets.UTF_8);
} }
public byte[] createPDFBytes(String xmlLogfileContent) { public byte[] createPDFBytes(String xmlLogfileContent) {

View File

@@ -56,7 +56,7 @@ public class XMLUpgrader {
ByteArrayOutputStream baos = new ByteArrayOutputStream(); ByteArrayOutputStream baos = new ByteArrayOutputStream();
applySchematronXsl(new FileInputStream(xmlFilename), baos); applySchematronXsl(new FileInputStream(xmlFilename), baos);
String res = null; String res = null;
res = baos.toString(StandardCharsets.UTF_8); res = new String(baos.toByteArray(), StandardCharsets.UTF_8);
return res; return res;
} }

View File

@@ -385,7 +385,7 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
} }
String businessProcessId = trans.getBusinessProcessId(); String businessProcessId = trans.getBusinessProcessId();
if (businessProcessId != null && !businessProcessId.isBlank()) { if (businessProcessId != null && !businessProcessId.trim().isEmpty()) {
xml += "<ram:BusinessProcessSpecifiedDocumentContextParameter>\n" xml += "<ram:BusinessProcessSpecifiedDocumentContextParameter>\n"
+ "<ram:ID>" + XMLTools.encodeXML(businessProcessId) + "</ram:ID>\n" + "<ram:ID>" + XMLTools.encodeXML(businessProcessId) + "</ram:ID>\n"
+ "</ram:BusinessProcessSpecifiedDocumentContextParameter>\n"; + "</ram:BusinessProcessSpecifiedDocumentContextParameter>\n";

View File

@@ -36,16 +36,7 @@ import java.nio.file.Paths;
import java.nio.file.StandardOpenOption; import java.nio.file.StandardOpenOption;
import java.text.ParseException; import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.*;
import java.util.Arrays;
import java.util.Base64;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.Set;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
@@ -246,14 +237,14 @@ public class ZUGFeRDInvoiceImporter {
*/ */
final PDEmbeddedFile embeddedFile = fileSpec.getEmbeddedFile(); final PDEmbeddedFile embeddedFile = fileSpec.getEmbeddedFile();
Set<String> validFilenames = Set.of( Set<String> validFilenames = new HashSet<>(Arrays.asList(
"ZUGFeRD-invoice.xml", "ZUGFeRD-invoice.xml",
"zugferd-invoice.xml", "zugferd-invoice.xml",
"factur-x.xml", "factur-x.xml",
"xrechnung.xml", "xrechnung.xml",
"order-x.xml", "order-x.xml",
"cida.xml" "cida.xml"
); ));
if (validFilenames.contains(filename)) { if (validFilenames.contains(filename)) {
containsMeta = true; containsMeta = true;
@@ -644,7 +635,7 @@ public class ZUGFeRDInvoiceImporter {
zpp.addNotes(includedNotes); zpp.addNotes(includedNotes);
String rootNode = extractString("local-name(/*)"); String rootNode = extractString("local-name(/*)");
String potentialCashDiscountTerms=null; String potentialCashDiscountTerms=null;
if (rootNode != null && Set.of("Invoice", "CreditNote").contains(rootNode)) { if (rootNode != null && new HashSet<>(Arrays.asList("Invoice", "CreditNote")).contains(rootNode)) {
// UBL... // UBL...
// //*[local-name()="Invoice" or local-name()="CreditNote"] // //*[local-name()="Invoice" or local-name()="CreditNote"]
number = extractString("/*[local-name()=\"Invoice\" or local-name()=\"CreditNote\"]/*[local-name()=\"ID\"]").trim(); number = extractString("/*[local-name()=\"Invoice\" or local-name()=\"CreditNote\"]/*[local-name()=\"ID\"]").trim();
@@ -1374,7 +1365,7 @@ public class ZUGFeRDInvoiceImporter {
if (whichType != EStandard.despatchadvice && !ignoreCalculationErrors) { if (whichType != EStandard.despatchadvice && !ignoreCalculationErrors) {
// Check calculation if document type allows it and calculation errors should not be ignored // Check calculation if document type allows it and calculation errors should not be ignored
String payableTotalFromXml = XMLTools.nDigitFormat(Objects.requireNonNullElse(duePayableAmount, expectedGrandTotal), 2); String payableTotalFromXml = XMLTools.nDigitFormat(Objects.requireNonNull(duePayableAmount != null ? duePayableAmount : expectedGrandTotal), 2);
if (!calculatedPayableTotal.equals(payableTotalFromXml)) { if (!calculatedPayableTotal.equals(payableTotalFromXml)) {
String moreDetails = ""; String moreDetails = "";
try { try {

View File

@@ -142,7 +142,7 @@ public class ZUGFeRDVisualizer {
if (thestandard == EStandard.zugferd) { if (thestandard == EStandard.zugferd) {
applyZF1XSLT(xmlContentStream, htmlOutput); applyZF1XSLT(xmlContentStream, htmlOutput);
return htmlOutput.toString(StandardCharsets.UTF_8); return new String(htmlOutput.toByteArray(), StandardCharsets.UTF_8);
} else if (thestandard == EStandard.facturx) { } else if (thestandard == EStandard.facturx) {
//zf2 or fx //zf2 or fx
applyZF2XSLT(xmlContentStream, htmlOutput); applyZF2XSLT(xmlContentStream, htmlOutput);
@@ -164,7 +164,7 @@ public class ZUGFeRDVisualizer {
applyXSLTToHTML(in.get(), htmlOutStream, lang); applyXSLTToHTML(in.get(), htmlOutStream, lang);
} }
return htmlOutStream.toString(StandardCharsets.UTF_8); return new String(htmlOutStream.toByteArray(), StandardCharsets.UTF_8);
} }
/** /**
@@ -258,7 +258,7 @@ public class ZUGFeRDVisualizer {
if (in.isPresent()) { if (in.isPresent()) {
applyXSLTToPDF(in.get(), baos, lang); applyXSLTToPDF(in.get(), baos, lang);
} }
return baos.toString(StandardCharsets.UTF_8); return new String(baos.toByteArray(), StandardCharsets.UTF_8);
} }
public void toPDF(String xmlFilename, String pdfFilename) { public void toPDF(String xmlFilename, String pdfFilename) {

View File

@@ -66,7 +66,7 @@ public class BackwardCompatibilityTest extends TestCase implements IExportableTr
ByteArrayOutputStream baos = new ByteArrayOutputStream(); ByteArrayOutputStream baos = new ByteArrayOutputStream();
ze.export(baos); ze.export(baos);
ze.close(); ze.close();
String pdfContent = baos.toString(StandardCharsets.UTF_8); String pdfContent = new String(baos.toByteArray(), StandardCharsets.UTF_8);
assertFalse(pdfContent.indexOf("(via mustangproject.org") == -1); assertFalse(pdfContent.indexOf("(via mustangproject.org") == -1);
// check for pdf-a schema extension // check for pdf-a schema extension
// assertFalse(pdfContent.indexOf("<zf:ConformanceLevel>EN 16931</zf:ConformanceLevel>") == -1); // assertFalse(pdfContent.indexOf("<zf:ConformanceLevel>EN 16931</zf:ConformanceLevel>") == -1);
@@ -106,7 +106,7 @@ public class BackwardCompatibilityTest extends TestCase implements IExportableTr
ByteArrayOutputStream baos = new ByteArrayOutputStream(); ByteArrayOutputStream baos = new ByteArrayOutputStream();
ze.export(baos); ze.export(baos);
ze.close(); ze.close();
String pdfContent = baos.toString(StandardCharsets.UTF_8); String pdfContent = new String(baos.toByteArray(), StandardCharsets.UTF_8);
assertFalse(pdfContent.indexOf("(via mustangproject.org") == -1); assertFalse(pdfContent.indexOf("(via mustangproject.org") == -1);
// check for pdf-a schema extension // check for pdf-a schema extension
// assertFalse(pdfContent.indexOf("<zf:ConformanceLevel>EN 16931</zf:ConformanceLevel>") == -1); // assertFalse(pdfContent.indexOf("<zf:ConformanceLevel>EN 16931</zf:ConformanceLevel>") == -1);
@@ -144,7 +144,7 @@ public class BackwardCompatibilityTest extends TestCase implements IExportableTr
ByteArrayOutputStream baos = new ByteArrayOutputStream(); ByteArrayOutputStream baos = new ByteArrayOutputStream();
ze.export(baos); ze.export(baos);
ze.close(); ze.close();
String pdfContent = baos.toString(StandardCharsets.UTF_8); String pdfContent = new String(baos.toByteArray(), StandardCharsets.UTF_8);
assertFalse(pdfContent.indexOf("(via mustangproject.org") == -1); assertFalse(pdfContent.indexOf("(via mustangproject.org") == -1);
// check for pdf-a schema extension // check for pdf-a schema extension
// assertFalse(pdfContent.indexOf("<zf:ConformanceLevel>EN 16931</zf:ConformanceLevel>") == -1); // assertFalse(pdfContent.indexOf("<zf:ConformanceLevel>EN 16931</zf:ConformanceLevel>") == -1);

View File

@@ -63,10 +63,10 @@ public class DeSerializationTest extends ResourceCase {
public void testProduct() throws IOException, XPathExpressionException, ParseException { public void testProduct() throws IOException, XPathExpressionException, ParseException {
File inputCII = getResourceAsFile("Extended_fremdwaehrung.xml"); File inputCII = getResourceAsFile("Extended_fremdwaehrung.xml");
var zii = new ZUGFeRDInvoiceImporter(); ZUGFeRDInvoiceImporter zii = new ZUGFeRDInvoiceImporter();
zii.doIgnoreCalculationErrors(); zii.doIgnoreCalculationErrors();
zii.fromXML(Files.readString(inputCII.toPath())); zii.fromXML(new String(Files.readAllBytes(inputCII.toPath())));
var product = zii.extractInvoice() IZUGFeRDExportableProduct product = zii.extractInvoice()
.getZFItems()[0] .getZFItems()[0]
.getProduct(); .getProduct();

View File

@@ -271,7 +271,7 @@ public class MustangReaderWriterCustomXMLTest extends TestCase {
zea1.export(TARGET_PDF); zea1.export(TARGET_PDF);
zea1.export(baos); zea1.export(baos);
zea1.close(); zea1.close();
String pdfContent = baos.toString(StandardCharsets.UTF_8); String pdfContent = new String(baos.toByteArray(), StandardCharsets.UTF_8);
assertFalse(pdfContent.indexOf("(via mustangproject.org") == -1); assertFalse(pdfContent.indexOf("(via mustangproject.org") == -1);
assertFalse(pdfContent.indexOf("<fx:ConformanceLevel>EN 16931</fx:ConformanceLevel>") == -1); assertFalse(pdfContent.indexOf("<fx:ConformanceLevel>EN 16931</fx:ConformanceLevel>") == -1);
@@ -460,7 +460,7 @@ public class MustangReaderWriterCustomXMLTest extends TestCase {
zea1.export(TARGET_PDF); zea1.export(TARGET_PDF);
zea1.export(baos); zea1.export(baos);
zea1.close(); zea1.close();
String pdfContent = baos.toString(StandardCharsets.UTF_8); String pdfContent = new String(baos.toByteArray(), StandardCharsets.UTF_8);
assertFalse(pdfContent.indexOf("(via mustangproject.org") == -1); assertFalse(pdfContent.indexOf("(via mustangproject.org") == -1);
assertFalse(pdfContent.indexOf("<zf:ConformanceLevel>BASIC</zf:ConformanceLevel>") == -1); assertFalse(pdfContent.indexOf("<zf:ConformanceLevel>BASIC</zf:ConformanceLevel>") == -1);

View File

@@ -373,7 +373,7 @@ public class MustangReaderWriterTest extends MustangReaderTestCase {
ByteArrayOutputStream baos = new ByteArrayOutputStream(); ByteArrayOutputStream baos = new ByteArrayOutputStream();
ze.export(baos); ze.export(baos);
ze.close(); ze.close();
String pdfContent = baos.toString(StandardCharsets.UTF_8); String pdfContent = new String(baos.toByteArray(), StandardCharsets.UTF_8);
assertFalse(pdfContent.indexOf("(via mustangproject.org") == -1); assertFalse(pdfContent.indexOf("(via mustangproject.org") == -1);
// check for pdf-a schema extension // check for pdf-a schema extension
// assertFalse(pdfContent.indexOf("<zf:ConformanceLevel>EN 16931</zf:ConformanceLevel>") == -1); // assertFalse(pdfContent.indexOf("<zf:ConformanceLevel>EN 16931</zf:ConformanceLevel>") == -1);
@@ -445,7 +445,7 @@ public class MustangReaderWriterTest extends MustangReaderTestCase {
result.write(buffer, 0, length); result.write(buffer, 0, length);
} }
var bytes = result.toByteArray(); byte[] bytes = result.toByteArray();
ze.addAdditionalFile("test.pdf", bytes); ze.addAdditionalFile("test.pdf", bytes);
ze.setTransaction(this); ze.setTransaction(this);

View File

@@ -90,7 +90,7 @@ public class UBLTest extends ResourceCase {
final ByteArrayOutputStream baos=new ByteArrayOutputStream(); final ByteArrayOutputStream baos=new ByteArrayOutputStream();
oe.export(baos); oe.export(baos);
final String theXML = baos.toString(StandardCharsets.UTF_8); final String theXML = new String(baos.toByteArray(), StandardCharsets.UTF_8);
assertTrue(theXML.contains("<DespatchAdvice")); assertTrue(theXML.contains("<DespatchAdvice"));
Files.write(Paths.get(TARGET_XML), theXML.getBytes(StandardCharsets.UTF_8)); Files.write(Paths.get(TARGET_XML), theXML.getBytes(StandardCharsets.UTF_8));
} catch (final IOException e) { } catch (final IOException e) {

View File

@@ -28,7 +28,7 @@
<github.global.server>github</github.global.server> <github.global.server>github</github.global.server>
<additionalparam>-Xdoclint:none</additionalparam> <additionalparam>-Xdoclint:none</additionalparam>
<!-- Skip error check for javadoc --> <!-- Skip error check for javadoc -->
<maven.compiler.release>11</maven.compiler.release> <maven.compiler.release>8</maven.compiler.release>
<maven.deploy.skip>true</maven.deploy.skip><!-- prevent this to be deployed to maven central as "core", <maven.deploy.skip>true</maven.deploy.skip><!-- prevent this to be deployed to maven central as "core",
we only want submodules, see also https://stackoverflow.com/questions/7446599/how-to-deploy-only-the-sub-modules-using-maven-deploy--> we only want submodules, see also https://stackoverflow.com/questions/7446599/how-to-deploy-only-the-sub-modules-using-maven-deploy-->
@@ -247,7 +247,7 @@
<configuration> <configuration>
<toolchains> <toolchains>
<jdk> <jdk>
<version>11</version> <version>8</version>
<vendor>adopt</vendor> <vendor>adopt</vendor>
</jdk> </jdk>
</toolchains> </toolchains>

View File

@@ -200,7 +200,7 @@ public class PDFValidator extends Validator {
for (int i = 0; i < nodes.getLength(); i++) { for (int i = 0; i < nodes.getLength(); i++) {
Node item = nodes.item(i); Node item = nodes.item(i);
String textContent = item.getTextContent(); String textContent = item.getTextContent();
if (textContent != null && Set.of("INVOICE", "ORDER", "ORDER_RESPONSE", "ORDER_CHANGE").contains(textContent)) { if (textContent != null && new HashSet<>(Arrays.asList("INVOICE", "ORDER", "ORDER_RESPONSE", "ORDER_CHANGE").contains(textContent)) {
documentTypeValid = true; documentTypeValid = true;
} }
} }

View File

@@ -227,7 +227,7 @@ public class XMLValidator extends Validator {
if (isBasicWithoutLines) { if (isBasicWithoutLines) {
isBasic = false;// basicwl also contains the string basic... isBasic = false;// basicwl also contains the string basic...
} }
isEN16931 = Set.of( isEN16931 = new HashSet<>(Arrays.asList(
"urn:cen.eu:en16931:2017:compliant:factur-x.eu:1p0:en16931", "urn:cen.eu:en16931:2017:compliant:factur-x.eu:1p0:en16931",
"urn:cen.eu:en16931:2017" "urn:cen.eu:en16931:2017"
) )
@@ -297,7 +297,7 @@ public class XMLValidator extends Validator {
//validateSchema(zfXML.getBytes(StandardCharsets.UTF_8), "ZF_211/EN16931/FACTUR-X_EN16931.xsd", 18, EPart.fx); //validateSchema(zfXML.getBytes(StandardCharsets.UTF_8), "ZF_211/EN16931/FACTUR-X_EN16931.xsd", 18, EPart.fx);
String xrVersion = contextProfile.substring(contextProfile.length() - 3).replace(".", ""); String xrVersion = contextProfile.substring(contextProfile.length() - 3).replace(".", "");
Set<String> supportedVersions = Set.of("12", "20", "21", "22", "23", "30"); Set<String> supportedVersions = new HashSet<>(Arrays.asList("12", "20", "21", "22", "23", "30");
if (!supportedVersions.contains(xrVersion)) { if (!supportedVersions.contains(xrVersion)) {
throw new Exception("Unsupported XR version"); throw new Exception("Unsupported XR version");
} }
@@ -311,7 +311,7 @@ public class XMLValidator extends Validator {
} else if ("CrossIndustryDocument".equalsIgnoreCase(rootLocalName)) { // ZUGFeRD 1.0 } else if ("CrossIndustryDocument".equalsIgnoreCase(rootLocalName)) { // ZUGFeRD 1.0
context.setGeneration("1"); context.setGeneration("1");
// //
Set<String> validZF1Profiles = Set.of( Set<String> validZF1Profiles = new HashSet<>(Arrays.asList(
"urn:ferd:CrossIndustryDocument:invoice:1p0:basic", "urn:ferd:CrossIndustryDocument:invoice:1p0:basic",
"urn:ferd:CrossIndustryDocument:invoice:1p0:comfort", "urn:ferd:CrossIndustryDocument:invoice:1p0:comfort",
"urn:ferd:CrossIndustryDocument:invoice:1p0:extended" "urn:ferd:CrossIndustryDocument:invoice:1p0:extended"
@@ -329,7 +329,7 @@ public class XMLValidator extends Validator {
if ("CII".equals(context.getFormat())) { if ("CII".equals(context.getFormat())) {
if ("2".equals(context.getGeneration())) { if ("2".equals(context.getGeneration())) {
Set<String> validZF2Profiles = Set.of( Set<String> validZF2Profiles = new HashSet<>(Arrays.asList(
"urn:factur-x.eu:1p0:minimum", "urn:factur-x.eu:1p0:minimum",
"urn:zugferd.de:2p0:minimum", "urn:zugferd.de:2p0:minimum",
"urn:factur-x.eu:1p0:basicwl", "urn:factur-x.eu:1p0:basicwl",
@@ -346,7 +346,7 @@ public class XMLValidator extends Validator {
} else /** v1 */ { } else /** v1 */ {
if (isOrderX) { if (isOrderX) {
//order-x 1.0 //order-x 1.0
if(Set.of( if(new HashSet<>(Arrays.asList(
"urn:order-x.eu:1p0:basic", "urn:order-x.eu:1p0:basic",
"urn:order-x.eu:1p0:comfort", "urn:order-x.eu:1p0:comfort",
"urn:order-x.eu:1p0:extended" "urn:order-x.eu:1p0:extended"
@@ -354,7 +354,7 @@ public class XMLValidator extends Validator {
addUnsupportedProfileResultItem(); addUnsupportedProfileResultItem();
} }
} else if (Set.of( } else if (new HashSet<>(Arrays.asList(
"urn:ferd:CrossIndustryDocument:invoice:1p0:basic", "urn:ferd:CrossIndustryDocument:invoice:1p0:basic",
"urn:ferd:CrossIndustryDocument:invoice:1p0:comfort", "urn:ferd:CrossIndustryDocument:invoice:1p0:comfort",
"urn:ferd:CrossIndustryDocument:invoice:1p0:extended" "urn:ferd:CrossIndustryDocument:invoice:1p0:extended"