From e77708d9be55716c5d4e6cc14d2a08e9096aca00 Mon Sep 17 00:00:00 2001
From: Dave Cramer <davec@fastcrypt.com>
Date: Thu, 11 Dec 2003 15:11:43 +0000
Subject: [PATCH] patch to make sure PSQLState is Serializable and a test case
 to prove it

---
 .../org/postgresql/test/jdbc2/MiscTest.java     | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/src/interfaces/jdbc/org/postgresql/test/jdbc2/MiscTest.java b/src/interfaces/jdbc/org/postgresql/test/jdbc2/MiscTest.java
index 5073f9b1fa4..c6b2e04b955 100644
--- a/src/interfaces/jdbc/org/postgresql/test/jdbc2/MiscTest.java
+++ b/src/interfaces/jdbc/org/postgresql/test/jdbc2/MiscTest.java
@@ -3,9 +3,10 @@ package org.postgresql.test.jdbc2;
 import org.postgresql.test.TestUtil;
 import junit.framework.TestCase;
 import java.sql.*;
+import java.io.*;
 
 /*
- * $PostgreSQL: pgsql/src/interfaces/jdbc/org/postgresql/test/jdbc2/MiscTest.java,v 1.11 2003/11/29 22:41:23 pgsql Exp $
+ * $PostgreSQL: pgsql/src/interfaces/jdbc/org/postgresql/test/jdbc2/MiscTest.java,v 1.12 2003/12/11 15:11:43 davec Exp $
  *
  * Some simple tests based on problems reported by users. Hopefully these will
  * help prevent previous problems from re-occuring ;-)
@@ -65,8 +66,18 @@ public class MiscTest extends TestCase
 			fail( "Should not execute this, as a SQLException s/b thrown" );
 			con.commit();
 		}
-		catch ( Exception ex )
-		{}
+		catch ( SQLException ex )
+		{
+			// Verify that the SQLException is serializable.
+			try {
+				ByteArrayOutputStream baos = new ByteArrayOutputStream();
+				ObjectOutputStream oos = new ObjectOutputStream(baos);
+				oos.writeObject(ex);
+				oos.close();
+			} catch (IOException ioe) {
+				fail(ioe.getMessage());
+			}
+		}
 		try
 		{
 			con.commit();
-- 
GitLab