Index: org/postgresql/jdbc2/optional/PooledConnectionImpl.java =================================================================== RCS file: /projects/cvsroot/pgsql-server/src/interfaces/jdbc/org/postgresql/jdbc2/optional/PooledConnectionImpl.java,v retrieving revision 1.4 diff -c -r1.4 PooledConnectionImpl.java *** org/postgresql/jdbc2/optional/PooledConnectionImpl.java 2002/12/11 11:42:14 1.4 --- org/postgresql/jdbc2/optional/PooledConnectionImpl.java 2002/12/12 19:56:12 *************** *** 204,210 **** return Boolean.FALSE; } } ! return method.invoke(con, args); } // All the rest is from the Connection interface if (method.getName().equals("isClosed")) --- 204,217 ---- return Boolean.FALSE; } } ! try ! { ! return method.invoke(con, args); ! } ! catch (InvocationTargetException e) ! { ! throw e.getTargetException(); ! } } // All the rest is from the Connection interface if (method.getName().equals("isClosed")) *************** *** 355,361 **** } else { ! return method.invoke(st, args); } } } --- 362,375 ---- } else { ! try ! { ! return method.invoke(st, args); ! } ! catch (InvocationTargetException e) ! { ! throw e.getTargetException(); ! } } } } Index: org/postgresql/test/jdbc2/optional/ConnectionPoolTest.java =================================================================== RCS file: /projects/cvsroot/pgsql-server/src/interfaces/jdbc/org/postgresql/test/jdbc2/optional/ConnectionPoolTest.java,v retrieving revision 1.4 diff -c -r1.4 ConnectionPoolTest.java *** org/postgresql/test/jdbc2/optional/ConnectionPoolTest.java 2002/12/11 11:42:14 1.4 --- org/postgresql/test/jdbc2/optional/ConnectionPoolTest.java 2002/12/12 19:56:12 *************** *** 360,365 **** --- 360,397 ---- } /** + * Ensures that the Statement proxy generated by the Connection handle + * throws the correct kind of exception. + */ + public void testStatementProxy() { + Statement s = null; + try + { + PooledConnection pc = getPooledConnection(); + Connection con = pc.getConnection(); + s = con.createStatement(); + } + catch (SQLException e) + { + fail(e.getMessage()); + } + try + { + s.executeQuery("SELECT * FROM THIS_TABLE_SHOULD_NOT_EXIST"); + fail("An SQL exception was not thrown that should have been"); + } + catch (SQLException e) + { + ; // This is the expected and correct path + } + catch (Exception e) + { + fail("bad exception; was expecting SQLException, not" + + e.getClass().getName()); + } + } + + /** * Ensures that a prepared statement generated by a proxied connection * returns the proxied connection from getConnection() [not the physical * connection].