Compare commits
11 Commits
7a28c24c91
...
java8
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a44b175a6d | ||
| aff4f5080d | |||
|
|
9f22ce3b14 | ||
|
|
c97c949a2c | ||
|
|
3cd2273621 | ||
|
|
90ecf8313b | ||
|
|
a542a61194 | ||
|
|
a8d5ee8822 | ||
|
|
938d23dc87 | ||
|
|
926a953292 | ||
|
|
55486cca41 |
22
.gitea/workflows/maven.yml
Normal file
22
.gitea/workflows/maven.yml
Normal 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
|
||||
@@ -1,3 +1,5 @@
|
||||
- 'Fix possible StringIndexOutOfBoundsException when extracting XMP.'
|
||||
|
||||
2.23.1
|
||||
=======
|
||||
2026-05-13
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>org.mustangproject</groupId>
|
||||
<artifactId>core</artifactId>
|
||||
<version>2.23.1-SNAPSHOT</version>
|
||||
<version>2.23.2-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>Mustang-CLI</artifactId>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>org.mustangproject</groupId>
|
||||
<artifactId>core</artifactId>
|
||||
<version>2.23.1-SNAPSHOT</version>
|
||||
<version>2.23.2-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
@@ -44,7 +44,7 @@
|
||||
<github.global.server>github</github.global.server>
|
||||
<additionalparam>-Xdoclint:none</additionalparam>
|
||||
<!-- 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 -->
|
||||
</properties>
|
||||
<dependencies>
|
||||
@@ -169,8 +169,8 @@
|
||||
<!-- http://stackoverflow.com/questions/574594/how-can-i-create-an-executable-jar-with-dependencies-using-maven
|
||||
mvn clean compile assembly:single -->
|
||||
<!-- or whatever version you use -->
|
||||
<source>11</source>
|
||||
<target>11</target>
|
||||
<source>8</source>
|
||||
<target>8</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
@@ -331,7 +331,7 @@
|
||||
<configuration>
|
||||
<toolchains>
|
||||
<jdk>
|
||||
<version>11</version>
|
||||
<version>8</version>
|
||||
<vendor>adopt</vendor>
|
||||
</jdk>
|
||||
</toolchains>
|
||||
|
||||
@@ -5,6 +5,9 @@ import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import org.mustangproject.ZUGFeRD.IZUGFeRDExportableContact;
|
||||
import org.w3c.dom.Node;
|
||||
import org.w3c.dom.NodeList;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
/***
|
||||
@@ -115,7 +118,7 @@ public class Contact implements IZUGFeRDExportableContact {
|
||||
String localName = currentItemNode.getLocalName();
|
||||
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)
|
||||
&& currentItemNode.getFirstChild()!=null) {
|
||||
setName(currentItemNode.getFirstChild().getNodeValue());
|
||||
|
||||
@@ -72,6 +72,14 @@ public class IncludedNote {
|
||||
return new IncludedNote(content, SubjectCode.PMD);
|
||||
}
|
||||
|
||||
public static IncludedNote additionalInformationNote(String content) {
|
||||
return new IncludedNote(content, SubjectCode.ACB);
|
||||
}
|
||||
|
||||
public static IncludedNote invoiceInstructionNote(String content) {
|
||||
return new IncludedNote(content, SubjectCode.INV);
|
||||
}
|
||||
|
||||
public static IncludedNote unspecifiedNote(String content) {
|
||||
return new IncludedNote(content, null);
|
||||
}
|
||||
|
||||
@@ -335,7 +335,7 @@ public class Item implements IZUGFeRDExportableItem {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Deprecated(since = "2.14.0")
|
||||
@Deprecated()
|
||||
public Item addReferencedLineID(String s) {
|
||||
return addBuyerOrderReferencedDocumentLineID(s);
|
||||
}
|
||||
|
||||
@@ -2,7 +2,25 @@ package org.mustangproject;
|
||||
|
||||
/**
|
||||
* EN16931-ID: BT-21 - the qualification of the free text on the invoice from BT-22
|
||||
* In the first step only the recommended codes are implemented.
|
||||
* @see <a href="https://service.unece.org/trade/untdid/d96a/uncl/uncl4451.htm">UNTDID - D.96A - Element 4451</a> for a complete list of codes
|
||||
*
|
||||
* In the first step only the recommended codes are implemented:
|
||||
* AAI : General information / Allgemeine Informationen
|
||||
* SUR : Supplier remarks / Anmerkungen des Verkäufers
|
||||
* REG : Regulatory information / Regulatorische Informationen
|
||||
* ABL : Government information / Rechtliche Informationen
|
||||
* TXD : Tax declaration / Informationen zur Steuer
|
||||
* CUS : Customs declaration information / Zollinformationen
|
||||
*
|
||||
* plus
|
||||
* ACY : Introduction
|
||||
* AAK : Price conditions
|
||||
* ABZ : Instructions/information about revolving documentary credit
|
||||
* PMT : Payment information
|
||||
* PMD : Payment detail/remittance information
|
||||
* AAB : Terms of payments
|
||||
* ACB : Additional information
|
||||
* INV : Invoice instruction
|
||||
*/
|
||||
public enum SubjectCode {
|
||||
/**
|
||||
@@ -38,7 +56,7 @@ public enum SubjectCode {
|
||||
*/
|
||||
AAK,
|
||||
/**
|
||||
* Vehicle licence number
|
||||
* Instructions/information about revolving documentary credit
|
||||
*/
|
||||
ABZ,
|
||||
/**
|
||||
@@ -48,12 +66,18 @@ public enum SubjectCode {
|
||||
/**
|
||||
* Payment detail/remittance information
|
||||
*/
|
||||
|
||||
PMD,
|
||||
/**
|
||||
* Payment term
|
||||
*/
|
||||
AAB
|
||||
|
||||
AAB,
|
||||
/**
|
||||
* Additional information
|
||||
*/
|
||||
ACB,
|
||||
/**
|
||||
* Invoice instruction
|
||||
*/
|
||||
INV
|
||||
|
||||
}
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
package org.mustangproject;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
@@ -163,7 +161,7 @@ public class TradeParty implements IZUGFeRDExportableTradeParty {
|
||||
NodeList taxSchemechilds = partyTaxScheme.item(partyTaxSchemeIndex).getChildNodes();
|
||||
for (int taxSchemechildsIndex = 0; taxSchemechildsIndex < taxSchemechilds.getLength(); taxSchemechildsIndex++) {
|
||||
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();
|
||||
if (textContent != null && taxSchemeTypes.contains(textContent)) {
|
||||
setTaxID(CompanyId);
|
||||
|
||||
@@ -282,7 +282,7 @@ public class TransactionCalculator implements IAbsoluteValueProvider {
|
||||
itemVATAmount.setVatExemptionReasonText(reasonText);
|
||||
}
|
||||
final Optional<VATAmount> currentVatAmount = this.getCurrentVatAmount(vatAmounts, currentItem.getProduct().getTaxCategoryCode(), percent);
|
||||
if (currentVatAmount.isEmpty()) {
|
||||
if (!currentVatAmount.isPresent()) {
|
||||
vatAmounts.add(itemVATAmount);
|
||||
} else {
|
||||
this.mergeAdding(currentVatAmount.get(), itemVATAmount);
|
||||
@@ -299,7 +299,7 @@ public class TransactionCalculator implements IAbsoluteValueProvider {
|
||||
final BigDecimal chargeBasis = currentCharge.getTotalAmount(this);
|
||||
final VATAmount chargeVatAmount = new VATAmount(chargeBasis, chargeBasis.multiply(taxPercent.divide(new BigDecimal(100))), vatCategoryCode,
|
||||
vatDueDateTypeCode, taxPercent);
|
||||
if (currentChargeVatAmount.isEmpty()) {
|
||||
if (!currentChargeVatAmount.isPresent()) {
|
||||
vatAmounts.add(chargeVatAmount);
|
||||
} else {
|
||||
this.mergeAdding(currentChargeVatAmount.get(), chargeVatAmount);
|
||||
@@ -319,7 +319,7 @@ public class TransactionCalculator implements IAbsoluteValueProvider {
|
||||
allowanceNegativeBasis.multiply(taxPercent.divide(new BigDecimal(100))),
|
||||
currentAllowance.getCategoryCode() != null ? currentAllowance.getCategoryCode() : "S",
|
||||
vatDueDateTypeCode, taxPercent);
|
||||
if (currentAllowanceVatAmount.isEmpty()) {
|
||||
if (!currentAllowanceVatAmount.isPresent()) {
|
||||
vatAmounts.add(allowanceVATAmount);
|
||||
} else {
|
||||
this.mergeAdding(currentAllowanceVatAmount.get(), allowanceVATAmount);
|
||||
@@ -333,10 +333,13 @@ public class TransactionCalculator implements IAbsoluteValueProvider {
|
||||
public void mergeAdding(VATAmount vatAmount, VATAmount toAdd) {
|
||||
vatAmount.setBasis(vatAmount.getBasis().add(toAdd.getBasis()));
|
||||
vatAmount.setCalculated(vatAmount.getCalculated().add(toAdd.getCalculated()));
|
||||
if (toAdd.getVatExemptionReasonText() != null && !toAdd.getVatExemptionReasonText().isBlank()) {
|
||||
Optional.ofNullable(vatAmount.getVatExemptionReasonText()).filter(reasonText -> !reasonText.equals(toAdd.getVatExemptionReasonText())).ifPresentOrElse(
|
||||
text -> vatAmount.setVatExemptionReasonText(String.join(", ", text, toAdd.getVatExemptionReasonText())),
|
||||
() -> vatAmount.setVatExemptionReasonText(toAdd.getVatExemptionReasonText()));
|
||||
if (toAdd.getVatExemptionReasonText() != null && !toAdd.getVatExemptionReasonText().trim().isEmpty()) {
|
||||
Optional<String> text = Optional.ofNullable(vatAmount.getVatExemptionReasonText()).filter(reasonText -> !reasonText.equals(toAdd.getVatExemptionReasonText()));
|
||||
if (text.isPresent()) {
|
||||
vatAmount.setVatExemptionReasonText(String.join(", ", text.get(), toAdd.getVatExemptionReasonText()));
|
||||
} else {
|
||||
vatAmount.setVatExemptionReasonText(toAdd.getVatExemptionReasonText());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -76,7 +76,7 @@ public class ValidationLogVisualizer {
|
||||
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) {
|
||||
|
||||
@@ -56,7 +56,7 @@ public class XMLUpgrader {
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
applySchematronXsl(new FileInputStream(xmlFilename), baos);
|
||||
String res = null;
|
||||
res = baos.toString(StandardCharsets.UTF_8);
|
||||
res = new String(baos.toByteArray(), StandardCharsets.UTF_8);
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
@@ -385,7 +385,7 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
||||
}
|
||||
|
||||
String businessProcessId = trans.getBusinessProcessId();
|
||||
if (businessProcessId != null && !businessProcessId.isBlank()) {
|
||||
if (businessProcessId != null && !businessProcessId.trim().isEmpty()) {
|
||||
xml += "<ram:BusinessProcessSpecifiedDocumentContextParameter>\n"
|
||||
+ "<ram:ID>" + XMLTools.encodeXML(businessProcessId) + "</ram:ID>\n"
|
||||
+ "</ram:BusinessProcessSpecifiedDocumentContextParameter>\n";
|
||||
|
||||
@@ -36,16 +36,7 @@ import java.nio.file.Paths;
|
||||
import java.nio.file.StandardOpenOption;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
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.*;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
@@ -246,14 +237,14 @@ public class ZUGFeRDInvoiceImporter {
|
||||
*/
|
||||
|
||||
final PDEmbeddedFile embeddedFile = fileSpec.getEmbeddedFile();
|
||||
Set<String> validFilenames = Set.of(
|
||||
Set<String> validFilenames = new HashSet<>(Arrays.asList(
|
||||
"ZUGFeRD-invoice.xml",
|
||||
"zugferd-invoice.xml",
|
||||
"factur-x.xml",
|
||||
"xrechnung.xml",
|
||||
"order-x.xml",
|
||||
"cida.xml"
|
||||
);
|
||||
));
|
||||
|
||||
if (validFilenames.contains(filename)) {
|
||||
containsMeta = true;
|
||||
@@ -644,7 +635,7 @@ public class ZUGFeRDInvoiceImporter {
|
||||
zpp.addNotes(includedNotes);
|
||||
String rootNode = extractString("local-name(/*)");
|
||||
String potentialCashDiscountTerms=null;
|
||||
if (rootNode != null && Set.of("Invoice", "CreditNote").contains(rootNode)) {
|
||||
if (rootNode != null && new HashSet<>(Arrays.asList("Invoice", "CreditNote")).contains(rootNode)) {
|
||||
// UBL...
|
||||
// //*[local-name()="Invoice" or local-name()="CreditNote"]
|
||||
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) {
|
||||
// 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)) {
|
||||
String moreDetails = "";
|
||||
try {
|
||||
|
||||
@@ -142,7 +142,7 @@ public class ZUGFeRDVisualizer {
|
||||
|
||||
if (thestandard == EStandard.zugferd) {
|
||||
applyZF1XSLT(xmlContentStream, htmlOutput);
|
||||
return htmlOutput.toString(StandardCharsets.UTF_8);
|
||||
return new String(htmlOutput.toByteArray(), StandardCharsets.UTF_8);
|
||||
} else if (thestandard == EStandard.facturx) {
|
||||
//zf2 or fx
|
||||
applyZF2XSLT(xmlContentStream, htmlOutput);
|
||||
@@ -164,7 +164,7 @@ public class ZUGFeRDVisualizer {
|
||||
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()) {
|
||||
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) {
|
||||
|
||||
@@ -66,7 +66,7 @@ public class BackwardCompatibilityTest extends TestCase implements IExportableTr
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
ze.export(baos);
|
||||
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);
|
||||
// check for pdf-a schema extension
|
||||
// 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();
|
||||
ze.export(baos);
|
||||
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);
|
||||
// check for pdf-a schema extension
|
||||
// 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();
|
||||
ze.export(baos);
|
||||
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);
|
||||
// check for pdf-a schema extension
|
||||
// assertFalse(pdfContent.indexOf("<zf:ConformanceLevel>EN 16931</zf:ConformanceLevel>") == -1);
|
||||
|
||||
@@ -63,10 +63,10 @@ public class DeSerializationTest extends ResourceCase {
|
||||
|
||||
public void testProduct() throws IOException, XPathExpressionException, ParseException {
|
||||
File inputCII = getResourceAsFile("Extended_fremdwaehrung.xml");
|
||||
var zii = new ZUGFeRDInvoiceImporter();
|
||||
ZUGFeRDInvoiceImporter zii = new ZUGFeRDInvoiceImporter();
|
||||
zii.doIgnoreCalculationErrors();
|
||||
zii.fromXML(Files.readString(inputCII.toPath()));
|
||||
var product = zii.extractInvoice()
|
||||
zii.fromXML(new String(Files.readAllBytes(inputCII.toPath())));
|
||||
IZUGFeRDExportableProduct product = zii.extractInvoice()
|
||||
.getZFItems()[0]
|
||||
.getProduct();
|
||||
|
||||
|
||||
@@ -271,7 +271,7 @@ public class MustangReaderWriterCustomXMLTest extends TestCase {
|
||||
zea1.export(TARGET_PDF);
|
||||
zea1.export(baos);
|
||||
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("<fx:ConformanceLevel>EN 16931</fx:ConformanceLevel>") == -1);
|
||||
|
||||
@@ -460,7 +460,7 @@ public class MustangReaderWriterCustomXMLTest extends TestCase {
|
||||
zea1.export(TARGET_PDF);
|
||||
zea1.export(baos);
|
||||
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("<zf:ConformanceLevel>BASIC</zf:ConformanceLevel>") == -1);
|
||||
|
||||
|
||||
@@ -373,7 +373,7 @@ public class MustangReaderWriterTest extends MustangReaderTestCase {
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
ze.export(baos);
|
||||
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);
|
||||
// check for pdf-a schema extension
|
||||
// assertFalse(pdfContent.indexOf("<zf:ConformanceLevel>EN 16931</zf:ConformanceLevel>") == -1);
|
||||
@@ -445,7 +445,7 @@ public class MustangReaderWriterTest extends MustangReaderTestCase {
|
||||
result.write(buffer, 0, length);
|
||||
}
|
||||
|
||||
var bytes = result.toByteArray();
|
||||
byte[] bytes = result.toByteArray();
|
||||
ze.addAdditionalFile("test.pdf", bytes);
|
||||
|
||||
ze.setTransaction(this);
|
||||
|
||||
@@ -90,7 +90,7 @@ public class UBLTest extends ResourceCase {
|
||||
final ByteArrayOutputStream baos=new ByteArrayOutputStream();
|
||||
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"));
|
||||
Files.write(Paths.get(TARGET_XML), theXML.getBytes(StandardCharsets.UTF_8));
|
||||
} catch (final IOException e) {
|
||||
|
||||
6
pom.xml
6
pom.xml
@@ -3,7 +3,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.mustangproject</groupId>
|
||||
<artifactId>core</artifactId>
|
||||
<version>2.23.1-SNAPSHOT</version>
|
||||
<version>2.23.2-SNAPSHOT</version>
|
||||
<packaging>pom</packaging>
|
||||
<name>Mustang</name>
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
<github.global.server>github</github.global.server>
|
||||
<additionalparam>-Xdoclint:none</additionalparam>
|
||||
<!-- 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",
|
||||
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>
|
||||
<toolchains>
|
||||
<jdk>
|
||||
<version>11</version>
|
||||
<version>8</version>
|
||||
<vendor>adopt</vendor>
|
||||
</jdk>
|
||||
</toolchains>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>org.mustangproject</groupId>
|
||||
<artifactId>core</artifactId>
|
||||
<version>2.23.1-SNAPSHOT</version>
|
||||
<version>2.23.2-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>validator</artifactId>
|
||||
|
||||
@@ -131,8 +131,10 @@ public class PDFValidator extends Validator {
|
||||
String xmp;
|
||||
if (zi.getXMP() == null) {
|
||||
xmp = null;
|
||||
} else {
|
||||
} else if (zi.getXMP().indexOf('<') > 0) {
|
||||
xmp = zi.getXMP().substring(zi.getXMP().indexOf('<'));
|
||||
} else {
|
||||
xmp = zi.getXMP();
|
||||
}
|
||||
|
||||
final Document docXMP;
|
||||
@@ -198,7 +200,7 @@ public class PDFValidator extends Validator {
|
||||
for (int i = 0; i < nodes.getLength(); i++) {
|
||||
Node item = nodes.item(i);
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -227,7 +227,7 @@ public class XMLValidator extends Validator {
|
||||
if (isBasicWithoutLines) {
|
||||
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"
|
||||
)
|
||||
@@ -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);
|
||||
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)) {
|
||||
throw new Exception("Unsupported XR version");
|
||||
}
|
||||
@@ -311,7 +311,7 @@ public class XMLValidator extends Validator {
|
||||
} else if ("CrossIndustryDocument".equalsIgnoreCase(rootLocalName)) { // ZUGFeRD 1.0
|
||||
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:comfort",
|
||||
"urn:ferd:CrossIndustryDocument:invoice:1p0:extended"
|
||||
@@ -329,7 +329,7 @@ public class XMLValidator extends Validator {
|
||||
if ("CII".equals(context.getFormat())) {
|
||||
|
||||
if ("2".equals(context.getGeneration())) {
|
||||
Set<String> validZF2Profiles = Set.of(
|
||||
Set<String> validZF2Profiles = new HashSet<>(Arrays.asList(
|
||||
"urn:factur-x.eu:1p0:minimum",
|
||||
"urn:zugferd.de:2p0:minimum",
|
||||
"urn:factur-x.eu:1p0:basicwl",
|
||||
@@ -346,7 +346,7 @@ public class XMLValidator extends Validator {
|
||||
} else /** v1 */ {
|
||||
if (isOrderX) {
|
||||
//order-x 1.0
|
||||
if(Set.of(
|
||||
if(new HashSet<>(Arrays.asList(
|
||||
"urn:order-x.eu:1p0:basic",
|
||||
"urn:order-x.eu:1p0:comfort",
|
||||
"urn:order-x.eu:1p0:extended"
|
||||
@@ -354,7 +354,7 @@ public class XMLValidator extends Validator {
|
||||
addUnsupportedProfileResultItem();
|
||||
}
|
||||
|
||||
} else if (Set.of(
|
||||
} else if (new HashSet<>(Arrays.asList(
|
||||
"urn:ferd:CrossIndustryDocument:invoice:1p0:basic",
|
||||
"urn:ferd:CrossIndustryDocument:invoice:1p0:comfort",
|
||||
"urn:ferd:CrossIndustryDocument:invoice:1p0:extended"
|
||||
|
||||
Reference in New Issue
Block a user