You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pdfbox.apache.org by ti...@apache.org on 2023/11/05 18:06:11 UTC

svn commit: r1913598 - in /pdfbox/branches/3.0/pdfbox/src/main/java/org/apache/pdfbox: rendering/TilingPaintFactory.java text/TextPosition.java

Author: tilman
Date: Sun Nov  5 18:06:11 2023
New Revision: 1913598

URL: http://svn.apache.org/viewvc?rev=1913598&view=rev
Log:
PDFBOX-5660:  use Objects.equals(), by Axel Howind

Modified:
    pdfbox/branches/3.0/pdfbox/src/main/java/org/apache/pdfbox/rendering/TilingPaintFactory.java
    pdfbox/branches/3.0/pdfbox/src/main/java/org/apache/pdfbox/text/TextPosition.java

Modified: pdfbox/branches/3.0/pdfbox/src/main/java/org/apache/pdfbox/rendering/TilingPaintFactory.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/3.0/pdfbox/src/main/java/org/apache/pdfbox/rendering/TilingPaintFactory.java?rev=1913598&r1=1913597&r2=1913598&view=diff
==============================================================================
--- pdfbox/branches/3.0/pdfbox/src/main/java/org/apache/pdfbox/rendering/TilingPaintFactory.java (original)
+++ pdfbox/branches/3.0/pdfbox/src/main/java/org/apache/pdfbox/rendering/TilingPaintFactory.java Sun Nov  5 18:06:11 2023
@@ -20,6 +20,7 @@ import java.awt.geom.AffineTransform;
 import java.io.IOException;
 import java.lang.ref.WeakReference;
 import java.util.Map;
+import java.util.Objects;
 import java.util.WeakHashMap;
 
 import org.apache.commons.logging.Log;
@@ -103,15 +104,15 @@ class TilingPaintFactory
                 return false;
             }
             final TilingPaintParameter other = (TilingPaintParameter) obj;
-            if (this.matrix != other.matrix && (this.matrix == null || !this.matrix.equals(other.matrix)))
+            if (!Objects.equals(this.matrix, other.matrix))
             {
                 return false;
             }
-            if (this.patternDict != other.patternDict && (this.patternDict == null || !this.patternDict.equals(other.patternDict)))
+            if (!Objects.equals(this.patternDict, other.patternDict))
             {
                 return false;
             }
-            if (this.colorSpace != other.colorSpace && (this.colorSpace == null || !this.colorSpace.equals(other.colorSpace)))
+            if (!Objects.equals(this.colorSpace, other.colorSpace))
             {
                 return false;
             }
@@ -140,7 +141,7 @@ class TilingPaintFactory
                 LOG.debug("Couldn't convert color to RGB - treating as not equal", ex);
                 return false;
             }
-            return !(this.xform != other.xform && (this.xform == null || !this.xform.equals(other.xform)));
+            return Objects.equals(this.xform, other.xform);
         }
 
         @Override

Modified: pdfbox/branches/3.0/pdfbox/src/main/java/org/apache/pdfbox/text/TextPosition.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/3.0/pdfbox/src/main/java/org/apache/pdfbox/text/TextPosition.java?rev=1913598&r1=1913597&r2=1913598&view=diff
==============================================================================
--- pdfbox/branches/3.0/pdfbox/src/main/java/org/apache/pdfbox/text/TextPosition.java (original)
+++ pdfbox/branches/3.0/pdfbox/src/main/java/org/apache/pdfbox/text/TextPosition.java Sun Nov  5 18:06:11 2023
@@ -20,6 +20,7 @@ import java.text.Normalizer;
 import java.util.Arrays;
 import java.util.HashMap;
 import java.util.Map;
+import java.util.Objects;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.pdfbox.pdmodel.font.PDFont;
@@ -890,7 +891,7 @@ public final class TextPosition
         {
             return false;
         }
-        if (textMatrix != null ? !textMatrix.equals(that.textMatrix) : that.textMatrix != null)
+        if (!Objects.equals(textMatrix, that.textMatrix))
         {
             return false;
         }
@@ -898,7 +899,7 @@ public final class TextPosition
         {
             return false;
         }
-        return font != null ? font.equals(that.font) : that.font == null;
+        return Objects.equals(font, that.font);
         
         // If changing this method, do not compare mutable fields (PDFBOX-4701)        
     }