Skip to content

Commit e77708d

Browse files
author
Dave Cramer
committed
patch to make sure PSQLState is Serializable and a test case to prove it
1 parent 6717306 commit e77708d

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

src/interfaces/jdbc/org/postgresql/test/jdbc2/MiscTest.java

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@
33
import org.postgresql.test.TestUtil;
44
import junit.framework.TestCase;
55
import java.sql.*;
6+
import java.io.*;
67

78
/*
8-
* $PostgreSQL: pgsql/src/interfaces/jdbc/org/postgresql/test/jdbc2/MiscTest.java,v 1.11 2003/11/29 22:41:23 pgsql Exp $
9+
* $PostgreSQL: pgsql/src/interfaces/jdbc/org/postgresql/test/jdbc2/MiscTest.java,v 1.12 2003/12/11 15:11:43 davec Exp $
910
*
1011
* Some simple tests based on problems reported by users. Hopefully these will
1112
* help prevent previous problems from re-occuring ;-)
@@ -65,8 +66,18 @@ public void testError()
6566
fail( "Should not execute this, as a SQLException s/b thrown" );
6667
con.commit();
6768
}
68-
catch ( Exception ex )
69-
{}
69+
catch ( SQLException ex )
70+
{
71+
// Verify that the SQLException is serializable.
72+
try {
73+
ByteArrayOutputStream baos = new ByteArrayOutputStream();
74+
ObjectOutputStream oos = new ObjectOutputStream(baos);
75+
oos.writeObject(ex);
76+
oos.close();
77+
} catch (IOException ioe) {
78+
fail(ioe.getMessage());
79+
}
80+
}
7081
try
7182
{
7283
con.commit();

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy