@@ -23,8 +23,8 @@ This file is part of the iText (R) project.
23
23
package com .itextpdf .signatures .validation ;
24
24
25
25
import com .itextpdf .commons .actions .contexts .IMetaInfo ;
26
+ import com .itextpdf .commons .datastructures .Tuple2 ;
26
27
import com .itextpdf .commons .utils .MessageFormatUtil ;
27
- import com .itextpdf .commons .utils .Pair ;
28
28
import com .itextpdf .forms .PdfAcroForm ;
29
29
import com .itextpdf .forms .fields .PdfFormAnnotationUtil ;
30
30
import com .itextpdf .forms .fields .PdfFormCreator ;
@@ -159,7 +159,7 @@ public class DocumentRevisionsValidator {
159
159
private Set <PdfDictionary > newlyAddedFields ;
160
160
private Set <PdfDictionary > removedTaggedObjects ;
161
161
private Set <PdfDictionary > addedTaggedObjects ;
162
- private Pair <Set <PdfIndirectReference >, Set <PdfIndirectReference >> usuallyModifiedObjects ;
162
+ private Tuple2 <Set <PdfIndirectReference >, Set <PdfIndirectReference >> usuallyModifiedObjects ;
163
163
164
164
/**
165
165
* Creates new instance of {@link DocumentRevisionsValidator}.
@@ -350,7 +350,7 @@ private void mergeRevisionsInLinearizedDocument(PdfDocument document, List<Docum
350
350
351
351
private boolean validateRevision (ValidationReport validationReport , ValidationContext context ,
352
352
PdfDocument documentWithoutRevision , PdfDocument documentWithRevision , DocumentRevision currentRevision ) {
353
- usuallyModifiedObjects = new Pair <>(createUsuallyModifiedObjectsSet (documentWithoutRevision ),
353
+ usuallyModifiedObjects = new Tuple2 <>(createUsuallyModifiedObjectsSet (documentWithoutRevision ),
354
354
createUsuallyModifiedObjectsSet (documentWithRevision ));
355
355
if (!compareCatalogs (documentWithoutRevision , documentWithRevision , validationReport , context )) {
356
356
return false ;
@@ -1575,19 +1575,19 @@ private void removeAppearanceRelatedProperties(PdfDictionary annotDict) {
1575
1575
//
1576
1576
1577
1577
private static boolean comparePdfObjects (PdfObject pdfObject1 , PdfObject pdfObject2 ,
1578
- Pair <Set <PdfIndirectReference >, Set <PdfIndirectReference >> usuallyModifiedObjects ) {
1578
+ Tuple2 <Set <PdfIndirectReference >, Set <PdfIndirectReference >> usuallyModifiedObjects ) {
1579
1579
return comparePdfObjects (pdfObject1 , pdfObject2 , new ArrayList <>(), usuallyModifiedObjects );
1580
1580
}
1581
1581
1582
1582
private static boolean comparePdfObjects (PdfObject pdfObject1 , PdfObject pdfObject2 ,
1583
- List <Pair <PdfObject , PdfObject >> visitedObjects ,
1584
- Pair <Set <PdfIndirectReference >, Set <PdfIndirectReference >> usuallyModifiedObjects ) {
1585
- for (Pair <PdfObject , PdfObject > pair : visitedObjects ) {
1586
- if (pair .getKey () == pdfObject1 ) {
1587
- return pair .getValue () == pdfObject2 ;
1583
+ List <Tuple2 <PdfObject , PdfObject >> visitedObjects ,
1584
+ Tuple2 <Set <PdfIndirectReference >, Set <PdfIndirectReference >> usuallyModifiedObjects ) {
1585
+ for (Tuple2 <PdfObject , PdfObject > pair : visitedObjects ) {
1586
+ if (pair .getFirst () == pdfObject1 ) {
1587
+ return pair .getSecond () == pdfObject2 ;
1588
1588
}
1589
1589
}
1590
- visitedObjects .add (new Pair <>(pdfObject1 , pdfObject2 ));
1590
+ visitedObjects .add (new Tuple2 <>(pdfObject1 , pdfObject2 ));
1591
1591
if (Objects .equals (pdfObject1 , pdfObject2 )) {
1592
1592
return true ;
1593
1593
}
@@ -1598,10 +1598,10 @@ private static boolean comparePdfObjects(PdfObject pdfObject1, PdfObject pdfObje
1598
1598
return false ;
1599
1599
}
1600
1600
if (pdfObject1 .getIndirectReference () != null &&
1601
- usuallyModifiedObjects .getKey ().stream ().anyMatch (
1601
+ usuallyModifiedObjects .getFirst ().stream ().anyMatch (
1602
1602
reference -> isSameReference (reference , pdfObject1 .getIndirectReference ())) &&
1603
1603
pdfObject2 .getIndirectReference () != null &&
1604
- usuallyModifiedObjects .getValue ().stream ().anyMatch (
1604
+ usuallyModifiedObjects .getSecond ().stream ().anyMatch (
1605
1605
reference -> isSameReference (reference , pdfObject2 .getIndirectReference ()))) {
1606
1606
// These two objects are expected to not be completely equal, we check them independently.
1607
1607
// However, we still need to make sure those are same instances.
@@ -1638,8 +1638,8 @@ private static boolean comparePdfObjects(PdfObject pdfObject1, PdfObject pdfObje
1638
1638
}
1639
1639
1640
1640
private static boolean comparePdfArrays (PdfArray array1 , PdfArray array2 ,
1641
- List <Pair <PdfObject , PdfObject >> visitedObjects ,
1642
- Pair <Set <PdfIndirectReference >, Set <PdfIndirectReference >> usuallyModifiedObjects ) {
1641
+ List <Tuple2 <PdfObject , PdfObject >> visitedObjects ,
1642
+ Tuple2 <Set <PdfIndirectReference >, Set <PdfIndirectReference >> usuallyModifiedObjects ) {
1643
1643
if (array1 .size () != array2 .size ()) {
1644
1644
return false ;
1645
1645
}
@@ -1652,8 +1652,8 @@ private static boolean comparePdfArrays(PdfArray array1, PdfArray array2,
1652
1652
}
1653
1653
1654
1654
private static boolean comparePdfDictionaries (PdfDictionary dictionary1 , PdfDictionary dictionary2 ,
1655
- List <Pair <PdfObject , PdfObject >> visitedObjects ,
1656
- Pair <Set <PdfIndirectReference >, Set <PdfIndirectReference >> usuallyModifiedObjects ) {
1655
+ List <Tuple2 <PdfObject , PdfObject >> visitedObjects ,
1656
+ Tuple2 <Set <PdfIndirectReference >, Set <PdfIndirectReference >> usuallyModifiedObjects ) {
1657
1657
Set <Map .Entry <PdfName , PdfObject >> entrySet1 = dictionary1 .entrySet ();
1658
1658
Set <Map .Entry <PdfName , PdfObject >> entrySet2 = dictionary2 .entrySet ();
1659
1659
if (entrySet1 .size () != entrySet2 .size ()) {
@@ -1669,8 +1669,8 @@ private static boolean comparePdfDictionaries(PdfDictionary dictionary1, PdfDict
1669
1669
}
1670
1670
1671
1671
private static boolean comparePdfStreams (PdfStream stream1 , PdfStream stream2 ,
1672
- List <Pair <PdfObject , PdfObject >> visitedObjects ,
1673
- Pair <Set <PdfIndirectReference >, Set <PdfIndirectReference >> usuallyModifiedObjects ) {
1672
+ List <Tuple2 <PdfObject , PdfObject >> visitedObjects ,
1673
+ Tuple2 <Set <PdfIndirectReference >, Set <PdfIndirectReference >> usuallyModifiedObjects ) {
1674
1674
return Arrays .equals (stream1 .getBytes (), stream2 .getBytes ()) &&
1675
1675
comparePdfDictionaries (stream1 , stream2 , visitedObjects , usuallyModifiedObjects );
1676
1676
}
0 commit comments