Skip to content

Commit

Permalink
Added warning for duplicate MCID
Browse files Browse the repository at this point in the history
  • Loading branch information
ProxyNexus committed Mar 25, 2024
1 parent e2c9936 commit 81d32b9
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ class OperatorParser {

private final Deque<TransparencyGraphicsState> transparencyGraphicStateStack = new ArrayDeque<>();
private final Stack<GFOpMarkedContent> markedContentStack = new Stack<>();
private final Set<Long> mcidSet = new HashSet<Long>();
private final StructureElementAccessObject structureElementAccessObject;
private final TransparencyGraphicsState transparencyGraphicState = new TransparencyGraphicsState();
private final COSObject parentStructElem;
Expand Down Expand Up @@ -163,15 +164,23 @@ void parseOperator(List<org.verapdf.model.operator.Operator> processedOperators,
processedOperators.add(bmcOp);
this.markedContentStack.push(bmcOp);
break;
case Operators.BDC:
case Operators.BDC: {
PDFAFlavour.Specification specification = StaticContainers.getFlavour().getPart();
if (specification == PDFAFlavour.Specification.ISO_19005_3) {
checkAFKey(arguments, resourcesHandler);
}
GFOp_BDC bdcOp = new GFOp_BDC(arguments, resourcesHandler, getCurrentMarkedContent(), structureElementAccessObject, parentsTags, isRealContent);
Long mcid = bdcOp.getMCID();
if (mcid != null) {
if (mcidSet.contains(mcid)) {
LOGGER.log(Level.WARNING, "Content stream contains duplicate MCID - " + mcid);
}
mcidSet.add(mcid);
}
processedOperators.add(bdcOp);
this.markedContentStack.push(bdcOp);
break;
}
case Operators.EMC:
processedOperators.add(new GFOp_EMC(arguments));
if (!this.markedContentStack.empty()) {
Expand Down

0 comments on commit 81d32b9

Please sign in to comment.