[libpostgresql-jdbc-java] 02/24: Handle null value

Emmanuel Bourg ebourg-guest at moszumanska.debian.org
Mon Jan 9 21:17:38 UTC 2017


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

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

commit 0770ef82dcb80338c36b0be6c7199c47cfb9bd0d
Author: nicolas-f <github at nettrader.fr>
Date:   Thu Aug 28 16:28:49 2014 +0200

    Handle null value
    
    Conflicts:
    	org/postgresql/util/PGobject.java
---
 org/postgresql/util/PGobject.java | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/org/postgresql/util/PGobject.java b/org/postgresql/util/PGobject.java
index a62c138..728a6fd 100644
--- a/org/postgresql/util/PGobject.java
+++ b/org/postgresql/util/PGobject.java
@@ -1,6 +1,6 @@
 /*-------------------------------------------------------------------------
 *
-* Copyright (c) 2003-2011, PostgreSQL Global Development Group
+* Copyright (c) 2003-2014, PostgreSQL Global Development Group
 *
 *
 *-------------------------------------------------------------------------
@@ -8,6 +8,8 @@
 package org.postgresql.util;
 
 import java.io.Serializable;
+import java.lang.Object;
+import java.lang.Override;
 import java.sql.SQLException;
 
 /**
@@ -104,4 +106,13 @@ public class PGobject implements Serializable, Cloneable
     {
         return getValue();
     }
+
+    /**
+     * Compute hash. As equals() use only value. Return the same hash for the same value.
+     * @return Value hashcode, 0 if value is null {@link java.util.Objects#hashCode(Object)}
+     */
+    @Override
+    public int hashCode() {
+        return getValue() != null ? getValue().hashCode() : 0;
+    }
 }

-- 
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