[libpostgresql-jdbc-java] 08/09: Test to make sure PSQLWarning is Serializable (it wasn't).

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


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

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

commit 4a2def0b0c22fb1d4d12cba93d11a58e5f74c281
Author: Kris Jurka <books at ejurka.com>
Date:   Sun Apr 10 16:39:48 2005 +0000

    Test to make sure PSQLWarning is Serializable (it wasn't).
---
 org/postgresql/test/jdbc2/MiscTest.java     | 24 +++++++++++++++++++++++-
 org/postgresql/util/ServerErrorMessage.java |  5 +++--
 2 files changed, 26 insertions(+), 3 deletions(-)

diff --git a/org/postgresql/test/jdbc2/MiscTest.java b/org/postgresql/test/jdbc2/MiscTest.java
index 7fcd5b9..f4ee26b 100644
--- a/org/postgresql/test/jdbc2/MiscTest.java
+++ b/org/postgresql/test/jdbc2/MiscTest.java
@@ -3,7 +3,7 @@
 * Copyright (c) 2004-2005, PostgreSQL Global Development Group
 *
 * IDENTIFICATION
-*   $PostgreSQL: pgjdbc/org/postgresql/test/jdbc2/MiscTest.java,v 1.16 2004/11/09 08:54:39 jurka Exp $
+*   $PostgreSQL: pgjdbc/org/postgresql/test/jdbc2/MiscTest.java,v 1.17 2005/01/11 08:25:48 jurka Exp $
 *
 *-------------------------------------------------------------------------
 */
@@ -79,6 +79,28 @@ public class MiscTest extends TestCase
         con.close();
     }
 
+    public void testWarning() throws Exception
+    {
+        Connection con = TestUtil.openDB();
+        Statement stmt = con.createStatement();
+        stmt.execute("CREATE TEMP TABLE t(a int primary key)");
+        SQLWarning warning = stmt.getWarnings();
+        // We should get a warning about primary key index creation
+        // it's possible we won't depending on the server's
+        // client_min_messages setting.
+        while (warning != null) {
+            // Verify that the SQLWarning is serializable.
+            ByteArrayOutputStream baos = new ByteArrayOutputStream();
+            ObjectOutputStream oos = new ObjectOutputStream(baos);
+            oos.writeObject(warning);
+            oos.close();
+            warning = warning.getNextWarning();
+        }
+
+        stmt.close();
+        con.close();
+    }
+
     public void xtestLocking() throws SQLException
     {
         Connection con = TestUtil.openDB();
diff --git a/org/postgresql/util/ServerErrorMessage.java b/org/postgresql/util/ServerErrorMessage.java
index e6b8a64..96aae59 100644
--- a/org/postgresql/util/ServerErrorMessage.java
+++ b/org/postgresql/util/ServerErrorMessage.java
@@ -3,7 +3,7 @@
 * Copyright (c) 2004-2005, PostgreSQL Global Development Group
 *
 * IDENTIFICATION
-*   $PostgreSQL: pgjdbc/org/postgresql/util/ServerErrorMessage.java,v 1.6 2005/01/11 08:25:49 jurka Exp $
+*   $PostgreSQL: pgjdbc/org/postgresql/util/ServerErrorMessage.java,v 1.6.2.1 2005/02/10 19:52:46 jurka Exp $
 *
 *-------------------------------------------------------------------------
 */
@@ -11,8 +11,9 @@ package org.postgresql.util;
 
 import org.postgresql.Driver;
 import java.util.Hashtable;
+import java.io.Serializable;
 
-public class ServerErrorMessage
+public class ServerErrorMessage implements Serializable
 {
 
     private static final Character SEVERITY = new Character('S');

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