From 84379cbdc3f6b5d4a459468a00213675ad10547b Mon Sep 17 00:00:00 2001 From: Maxim Date: Tue, 6 Aug 2024 18:14:30 +0300 Subject: [PATCH] Fix getStructureTypeStandardStructureType --- src/main/java/org/verapdf/pd/structure/PDStructElem.java | 2 +- .../java/org/verapdf/pd/structure/StructureType.java | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/verapdf/pd/structure/PDStructElem.java b/src/main/java/org/verapdf/pd/structure/PDStructElem.java index a5ae979f..539c0e89 100644 --- a/src/main/java/org/verapdf/pd/structure/PDStructElem.java +++ b/src/main/java/org/verapdf/pd/structure/PDStructElem.java @@ -137,7 +137,7 @@ public static StructureType getStructureTypeStandardStructureType(StructureType } if (!PDFFlavour.isFlavourPDFSpecification(flavour, PDFFlavour.PDFSpecification.ISO_32000_2_0) || PDFFlavour.isFlavourFamily(flavour, PDFFlavour.SpecificationFamily.WCAG)) { if (type != null) { - return new StructureType(ASAtom.getASAtom( + return StructureType.createStructureType(ASAtom.getASAtom( StaticResources.getRoleMapHelper().getStandardType(type.getType())), type.getNameSpace()); } } diff --git a/src/main/java/org/verapdf/pd/structure/StructureType.java b/src/main/java/org/verapdf/pd/structure/StructureType.java index 709f7e8f..369bc304 100644 --- a/src/main/java/org/verapdf/pd/structure/StructureType.java +++ b/src/main/java/org/verapdf/pd/structure/StructureType.java @@ -32,7 +32,7 @@ public class StructureType { private final ASAtom type; private final PDStructureNameSpace nameSpace; - public StructureType(ASAtom type, PDStructureNameSpace nameSpace) { + private StructureType(ASAtom type, PDStructureNameSpace nameSpace) { this.type = type; this.nameSpace = nameSpace; } @@ -62,6 +62,13 @@ public static StructureType createStructureType(COSObject type, COSObject ns) { return null; } + public static StructureType createStructureType(ASAtom type, PDStructureNameSpace nameSpace) { + if (type != null) { + return new StructureType(type, nameSpace); + } + return null; + } + public static StructureType createStructureType(ASAtom type) { if (type != null) { return new StructureType(type, null);