Skip to content

Commit 7a53280

Browse files
committed
PDFBOX-6009: refactor
git-svn-id: https://svn.apache.org/repos/asf/pdfbox/trunk@1925609 13f79535-47bb-0310-9956-ffa450edef68
1 parent af046a8 commit 7a53280

File tree

1 file changed

+21
-18
lines changed

1 file changed

+21
-18
lines changed

pdfbox/src/main/java/org/apache/pdfbox/multipdf/Splitter.java

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -426,24 +426,7 @@ private COSBase createDictionaryClone(COSBase src, COSBase dstParent, COSDiction
426426
else
427427
{
428428
// PDFBOX-6009: quit if MCIDs because these need a /Pg entry
429-
boolean hasMCIDs = false;
430-
if (kid instanceof COSInteger)
431-
{
432-
hasMCIDs = true;
433-
}
434-
else if (kid instanceof COSArray)
435-
{
436-
COSArray ar = (COSArray) kid;
437-
for (int i = 0; i < ar.size(); ++i)
438-
{
439-
if (ar.getObject(i) instanceof COSInteger)
440-
{
441-
hasMCIDs = true;
442-
break;
443-
}
444-
}
445-
}
446-
if (hasMCIDs)
429+
if (hasMCIDs(kid))
447430
{
448431
return null;
449432
}
@@ -519,6 +502,26 @@ else if (kid instanceof COSArray)
519502
return dstDict;
520503
}
521504

505+
private boolean hasMCIDs(COSBase kid)
506+
{
507+
if (kid instanceof COSInteger)
508+
{
509+
return true;
510+
}
511+
if (kid instanceof COSArray)
512+
{
513+
COSArray ar = (COSArray) kid;
514+
for (int i = 0; i < ar.size(); ++i)
515+
{
516+
if (ar.getObject(i) instanceof COSInteger)
517+
{
518+
return true;
519+
}
520+
}
521+
}
522+
return false;
523+
}
524+
522525
private void removePossibleOrphanAnnotation(COSDictionary srcObj, COSDictionary srcDict,
523526
COSDictionary currentPageDict, COSDictionary dstDict)
524527
{

0 commit comments

Comments
 (0)