Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fix connection leak in testcase

  • Loading branch information...
commit 991cee17686a42b12409d4f25eafbd1a5d836e4b 1 parent d4d1bd9
@jaikiran jaikiran authored n1hility committed
View
12 .../test/java/org/jboss/as/testsuite/integration/jpa/hibernate/SecondLevelCacheTestCase.java
@@ -125,10 +125,14 @@ public void testMultipleNonTXTransactionalEntityManagerInvocations() throws Exce
DataSource ds = rawLookup("java:jboss/datasources/ExampleDS", DataSource.class);
Connection conn = ds.getConnection();
- int deleted = conn.prepareStatement("delete from Employee").executeUpdate();
-
- // verify that delete worked (or test is invalid)
- assertTrue("was able to delete added rows. delete count=" + deleted, deleted > 1);
+ try {
+ int deleted = conn.prepareStatement("delete from Employee").executeUpdate();
+ // verify that delete worked (or test is invalid)
+ assertTrue("was able to delete added rows. delete count=" + deleted, deleted > 1);
+
+ } finally {
+ conn.close();
+ }
// read deleted data from second level cache
Employee emp = sfsb1.getEmployeeNoTX(10);
Please sign in to comment.
Something went wrong with that request. Please try again.