public void testBug10630() throws Exception {
  Connection conn2=null;
  Statement stmt2=null;
  try {
    conn2=getConnectionWithProps((Properties)null);
    stmt2=conn2.createStatement();
    conn2.close();
    stmt2.getWarnings();
    fail("Should've caught an exception here");
  }
 catch (  SQLException sqlEx) {
    assertEquals(SQLError.SQL_STATE_ILLEGAL_ARGUMENT,sqlEx.getSQLState());
  }
 finally {
    if (stmt2 != null) {
      stmt2.close();
    }
    if (conn2 != null) {
      conn2.close();
    }
  }
}

public void testBug10630 ( ) throws Exception { Connection conn2 = null ; Statement stmt2 = null ; try { conn2 = getConnectionWithProps ( ( Properties ) null ) ; stmt2 = conn2 . createStatement ( ) ; conn2 . close ( ) ; stmt2 . getWarnings ( ) ; fail ( "Should've caught an exception here" ) ; } catch ( SQLException sqlEx ) { assertEquals ( SQLError . SQL_STATE_ILLEGAL_ARGUMENT , sqlEx . getSQLState ( ) ) ; } finally { if ( stmt2 != null ) { stmt2 . close ( ) ; } if ( conn2 != null ) { conn2 . close ( ) ; } } }
tests fix for bug # 10630 , statement . getwarnings ( ) fails with npe if statement has been closed .
