File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2191,48 +2191,6 @@ public void BugDecimalRound_Bug_3561() {
21912191 "null\n " );
21922192 }
21932193
2194- @ Test
2195- public void Bug_IsValid_Timeout_Bug_6782 () {
2196- sb .setLength (0 ); // clear the output log buffer
2197-
2198- Connection con2 = null ;
2199- Statement st = null ;
2200- try {
2201- con2 = DriverManager .getConnection (jdbcUrl );
2202- sb .append ("connected :)\n " );
2203-
2204- st = con2 .createStatement ();
2205- st .setQueryTimeout (5 );
2206- sb .append ("getQueryTimeout must give 5: " ).append (st .getQueryTimeout ()).append ("\n " );
2207- st .close ();
2208-
2209- con .isValid (6 );
2210-
2211- st = con .createStatement ();
2212- sb .append ("getQueryTimeout must give 0: " ).append (st .getQueryTimeout ()).append ("\n " );
2213-
2214- con .isValid (4 );
2215- sb .append ("getQueryTimeout must give 0: " ).append (st .getQueryTimeout ()).append ("\n " );
2216- st .close ();
2217-
2218- st .setQueryTimeout (7 );
2219- con .isValid (3 );
2220- sb .append ("getQueryTimeout must give 7: " ).append (st .getQueryTimeout ()).append ("\n " );
2221- st .close ();
2222- } catch (SQLException se ) {
2223- sb .append (se .getMessage ()).append ("\n " );
2224- }
2225- closeStmtResSet (st , null );
2226- closeConx (con2 );
2227-
2228- compareExpectedOutput ("Bug_IsValid_Timeout_Bug_6782" ,
2229- "connected :)\n " +
2230- "getQueryTimeout must give 5: 5\n " +
2231- "getQueryTimeout must give 0: 0\n " +
2232- "getQueryTimeout must give 0: 0\n " +
2233- "getQueryTimeout must give 7: 7\n " );
2234- }
2235-
22362194 @ Test
22372195 public void Bug_LargeQueries_6571_6693 () {
22382196 sb .setLength (0 ); // clear the output log buffer
Original file line number Diff line number Diff line change @@ -1978,4 +1978,34 @@ public void testBug3350() throws SQLException {
19781978 });
19791979 }
19801980 }
1981+
1982+ @ Test
1983+ public void testIsValidTimeoutBug6782 () throws SQLException {
1984+ try (Connection conn2 = newConnection ()) {
1985+ Statement st ;
1986+
1987+ // Here 'st' is conn2's
1988+ st = conn2 .createStatement ();
1989+ st .setQueryTimeout (5 );
1990+ assertEquals (5 , st .getQueryTimeout ());
1991+ st .close ();
1992+
1993+ conn .isValid (6 );
1994+ // Here, 'st' is conn's
1995+ st = conn .createStatement ();
1996+ assertEquals (0 , st .getQueryTimeout ());
1997+
1998+ conn .isValid (4 );
1999+ assertEquals (0 , st .getQueryTimeout ());
2000+ st .close ();
2001+
2002+ // Here, 'st' is used after closing ????
2003+ st .setQueryTimeout (7 );
2004+ conn .isValid (3 );
2005+ assertEquals (7 , st .getQueryTimeout ());
2006+
2007+ // Here, 'st' is closed a second time. what are we testing here?
2008+ st .close ();
2009+ }
2010+ }
19812011}
You can’t perform that action at this time.
0 commit comments