[libpostgresql-jdbc-java] 09/11: RecoverdXid.equals was assuming that the object passed to it was an Xid which in the general case of the equals method is not true. To respect the contract of the equals method return false if the passed in object isn't an Xid.

Emmanuel Bourg ebourg-guest at moszumanska.debian.org
Mon Jan 9 10:19:58 UTC 2017


This is an automated email from the git hooks/post-receive script.

ebourg-guest pushed a commit to tag REL8_1_408
in repository libpostgresql-jdbc-java.

commit 7e5c4ca7ece66de9d1328bc1c5eddd8572b3c19d
Author: Kris Jurka <books at ejurka.com>
Date:   Sun Nov 5 06:12:28 2006 +0000

    RecoverdXid.equals was assuming that the object passed to it was
    an Xid which in the general case of the equals method is not
    true.  To respect the contract of the equals method return false
    if the passed in object isn't an Xid.
---
 org/postgresql/xa/RecoveredXid.java | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/org/postgresql/xa/RecoveredXid.java b/org/postgresql/xa/RecoveredXid.java
index 602bf63..3db91e8 100644
--- a/org/postgresql/xa/RecoveredXid.java
+++ b/org/postgresql/xa/RecoveredXid.java
@@ -26,6 +26,9 @@ class RecoveredXid implements Xid {
         if (o == this) // optimization for the common case.
             return true;
 
+        if (!(o instanceof Xid))
+            return false;
+
         Xid other = (Xid) o;
         if (other.getFormatId() != formatId)
             return false;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-java/libpostgresql-jdbc-java.git



More information about the pkg-java-commits mailing list