You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pdfbox.apache.org by ms...@apache.org on 2020/02/11 17:55:30 UTC
svn commit: r1873917 - in /pdfbox/branches/2.0/pdfbox/src:
main/java/org/apache/pdfbox/cos/COSArray.java
main/java/org/apache/pdfbox/cos/COSDictionary.java
test/java/org/apache/pdfbox/pdmodel/common/COSArrayListTest.java
Author: msahyoun
Date: Tue Feb 11 17:55:29 2020
New Revision: 1873917
URL: http://svn.apache.org/viewvc?rev=1873917&view=rev
Log:
PDFBOX-4669, PDFBOX-4723: partially revert - remove equals and hashCode; note that this will fail some functionality; tests disabled
Modified:
pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/cos/COSArray.java
pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/cos/COSDictionary.java
pdfbox/branches/2.0/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/common/COSArrayListTest.java
Modified: pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/cos/COSArray.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/cos/COSArray.java?rev=1873917&r1=1873916&r2=1873917&view=diff
==============================================================================
--- pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/cos/COSArray.java (original)
+++ pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/cos/COSArray.java Tue Feb 11 17:55:29 2020
@@ -18,7 +18,6 @@ package org.apache.pdfbox.cos;
import java.io.IOException;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
@@ -409,49 +408,6 @@ public class COSArray extends COSBase im
}
/**
- * {@inheritDoc}
- */
- @Override
- public boolean equals(Object o) {
-
- if (o == this)
- {
- return true;
- }
-
- if (!(o instanceof COSArray))
- {
- return false;
- }
-
- COSArray toBeCompared = (COSArray) o;
-
- if (toBeCompared.size() != size())
- {
- return false;
- }
-
- for (int i=0; i<size(); i++)
- {
- if (!(get(i).equals(toBeCompared.get(i))))
- {
- return false;
- }
- }
-
- return true;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public int hashCode() {
- Object[] members = {objects, needToBeUpdated};
- return Arrays.hashCode(members);
- }
-
- /**
* {@inheritDoc}
*/
@Override
Modified: pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/cos/COSDictionary.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/cos/COSDictionary.java?rev=1873917&r1=1873916&r2=1873917&view=diff
==============================================================================
--- pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/cos/COSDictionary.java (original)
+++ pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/cos/COSDictionary.java Tue Feb 11 17:55:29 2020
@@ -22,11 +22,9 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Collection;
-import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
-import java.util.Map.Entry;
import org.apache.pdfbox.io.IOUtils;
import org.apache.pdfbox.pdmodel.common.COSObjectable;
@@ -1540,64 +1538,6 @@ public class COSDictionary extends COSBa
/**
* {@inheritDoc}
- */
- @Override
- public boolean equals(Object o) {
- if (o == this)
- {
- return true;
- }
-
- if (o == null || !(o.getClass() == COSDictionary.class))
- {
- return false;
- }
-
- COSDictionary toBeCompared = (COSDictionary) o;
-
- if (toBeCompared.size() != size())
- {
- return false;
- }
-
- Iterator<Entry<COSName, COSBase>> iter = entrySet().iterator();
- while (iter.hasNext())
- {
- Entry<COSName, COSBase> entry = iter.next();
- COSName key = entry.getKey();
- COSBase value = entry.getValue();
-
- if (!toBeCompared.containsKey(key))
- {
- return false;
- }
- else if (value == null)
- {
- if (toBeCompared.getItem(key) != null)
- {
- return false;
- }
- }
- else if (!value.equals(toBeCompared.getItem(key)))
- {
- return false;
- }
- }
-
- return true;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public int hashCode() {
- Object[] members = {items, needToBeUpdated};
- return Arrays.hashCode(members);
- }
-
- /**
- * {@inheritDoc}
*/
@Override
public String toString()
Modified: pdfbox/branches/2.0/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/common/COSArrayListTest.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/2.0/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/common/COSArrayListTest.java?rev=1873917&r1=1873916&r2=1873917&view=diff
==============================================================================
--- pdfbox/branches/2.0/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/common/COSArrayListTest.java (original)
+++ pdfbox/branches/2.0/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/common/COSArrayListTest.java Tue Feb 11 17:55:29 2020
@@ -393,7 +393,11 @@ public class COSArrayListTest {
pdf.close();
}
- @Test
+ // @Test
+ // PDFBOX-4669, PDFBOX-4723
+ // This test is currently disabled with the removeAll function not properly
+ // working. See the discussion in above mentioned tickets about currently not implementing equals which the
+ // functionality would need to rely on.
public void removeDirectObject() throws IOException {
// generate test file
@@ -477,7 +481,11 @@ public class COSArrayListTest {
assertTrue("The size of the internal COSArray shall be 1", annotations.getCOSArray().size() == 1);
}
- @Test
+ // @Test
+ // PDFBOX-4669, PDFBOX-4723
+ // This test is currently disabled with the retainAll function not properly
+ // working. See the discussion in above mentioned tickets about currently not implementing equals which the
+ // functionality would need to rely on.
public void retainDirectObject() throws IOException {
// generate test file
@@ -521,7 +529,11 @@ public class COSArrayListTest {
assertTrue("The size of the internal COSArray shall be 3", annotations.getCOSArray().size() == 3);
}
- @Test
+ // @Test
+ // PDFBOX-4669, PDFBOX-4723
+ // This test is currently disabled with the retainAll function not properly
+ // working. See the discussion in above mentioned tickets about currently not implementing equals which the
+ // functionality would need to rely on.
public void retainIndirectObject() throws IOException {
// generate test file