Author: tilman
Date: Sun Oct 27 08:46:29 2024
New Revision: 1921592
URL: http://svn.apache.org/viewvc?rev=1921592&view=rev
Log:
PDFBOX-5890: add simpler method to pass MCID, check parameter for existing
method
Modified:
pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/documentinterchange/logicalstructure/PDStructureElement.java
Modified:
pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/documentinterchange/logicalstructure/PDStructureElement.java
URL:
http://svn.apache.org/viewvc/pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/documentinterchange/logicalstructure/PDStructureElement.java?rev=1921592&r1=1921591&r2=1921592&view=diff
==============================================================================
---
pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/documentinterchange/logicalstructure/PDStructureElement.java
(original)
+++
pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/documentinterchange/logicalstructure/PDStructureElement.java
Sun Oct 27 08:46:29 2024
@@ -624,7 +624,23 @@ public class PDStructureElement extends
/**
* Appends a marked-content sequence kid.
*
- * @param markedContent the marked-content sequence
+ * @param mcid the marked-content id (MCID).
+ * @throws IllegalArgumentException if the mcid is negative.
+ */
+ public void appendKid(int mcid)
+ {
+ if (mcid < 0)
+ {
+ throw new IllegalArgumentException("MCID should not be negative");
+ }
+ this.appendKid(COSInteger.get(mcid));
+ }
+
+ /**
+ * Appends a marked-content sequence kid.
+ *
+ * @param markedContent the marked-content sequence with the MCID.
+ * @throws IllegalArgumentException if the mcid is negative or doesn't
exist.
*/
public void appendKid(PDMarkedContent markedContent)
{
@@ -632,7 +648,12 @@ public class PDStructureElement extends
{
return;
}
- this.appendKid(COSInteger.get(markedContent.getMCID()));
+ int mcid = markedContent.getMCID();
+ if (mcid < 0)
+ {
+ throw new IllegalArgumentException("MCID is negative or doesn't
exist");
+ }
+ this.appendKid(COSInteger.get(mcid));
}
/**