diff --git a/pdfbox-validation-model/src/main/java/org/verapdf/model/ModelParser.java b/pdfbox-validation-model/src/main/java/org/verapdf/model/ModelParser.java index 9f6d560b..6870912b 100644 --- a/pdfbox-validation-model/src/main/java/org/verapdf/model/ModelParser.java +++ b/pdfbox-validation-model/src/main/java/org/verapdf/model/ModelParser.java @@ -21,6 +21,7 @@ package org.verapdf.model; import org.verapdf.xmp.XMPException; +import org.verapdf.containers.StaticCoreContainers; import org.verapdf.xmp.containers.StaticXmpCoreContainers; import org.verapdf.xmp.impl.VeraPDFMeta; import java.util.logging.Logger; @@ -73,11 +74,13 @@ public final class ModelParser implements PDFAParser { private ModelParser(final InputStream docStream, PDFAFlavour flavour, PDFAFlavour defaultFlavour) throws IOException { this.document = PDDocument.load(docStream, false, true); this.flavour = detectFlavour(this.document, flavour, defaultFlavour); + StaticCoreContainers.setFlavour(this.flavour); } private ModelParser(final File pdfFile, PDFAFlavour flavour, PDFAFlavour defaultFlavour) throws IOException { this.document = PDDocument.load(pdfFile, false, true); this.flavour = detectFlavour(this.document, flavour, defaultFlavour); + StaticCoreContainers.setFlavour(this.flavour); } public static ModelParser createModelWithFlavour(InputStream toLoad, PDFAFlavour flavour) @@ -158,6 +161,7 @@ private static PDFAFlavour obtainFlavour(PDDocument document, PDFAFlavour defaul private static void cleanUp() { StaticContainers.clearAllContainers(); + StaticCoreContainers.clearAllContainers(); StaticXmpCoreContainers.clearAllContainers(); } diff --git a/pdfbox-validation-model/src/main/java/org/verapdf/model/impl/pb/pd/PBoxPDMetadata.java b/pdfbox-validation-model/src/main/java/org/verapdf/model/impl/pb/pd/PBoxPDMetadata.java index 8b331fe1..04bdb435 100644 --- a/pdfbox-validation-model/src/main/java/org/verapdf/model/impl/pb/pd/PBoxPDMetadata.java +++ b/pdfbox-validation-model/src/main/java/org/verapdf/model/impl/pb/pd/PBoxPDMetadata.java @@ -103,7 +103,7 @@ private List getXMPPackage() { if (stream != null) { VeraPDFMeta metadata = VeraPDFMeta.parse(stream.getUnfilteredStream()); if (isMainMetadata) { - xmp.add(new AXLMainXMPPackage(metadata, true, this.flavour)); + xmp.add(new AXLMainXMPPackage(metadata, true)); } else if (this.flavour == null || this.flavour.getPart() == null || this.flavour.getPart().getPartNumber() != 1) { COSStream mainStream = mainMetadata.getStream(); @@ -112,16 +112,16 @@ private List getXMPPackage() { VeraPDFMeta mainMeta = VeraPDFMeta.parse(mainStream.getUnfilteredStream()); mainExtensionNode = mainMeta.getExtensionSchemasNode(); } - xmp.add(new AXLXMPPackage(metadata, true, mainExtensionNode, this.flavour)); + xmp.add(new AXLXMPPackage(metadata, true, mainExtensionNode)); } } } catch (XMPException | IOException e) { LOGGER.log(java.util.logging.Level.INFO, "Problems with parsing metadata. " + e.getMessage()); if (isMainMetadata) { - xmp.add(new AXLMainXMPPackage(null, false, this.flavour)); + xmp.add(new AXLMainXMPPackage(null, false)); } else if (this.flavour == null || this.flavour.getPart() == null || this.flavour.getPart().getPartNumber() != 1) { - xmp.add(new AXLXMPPackage(null, false, null, this.flavour)); + xmp.add(new AXLXMPPackage(null, false, null)); } } return xmp;