Skip to content

Commit

Permalink
Fixes a few minor memory leaks in the TCK.
Browse files Browse the repository at this point in the history
git-svn-id: https://olap4j.svn.sourceforge.net/svnroot/olap4j/trunk@548 c6a108a4-781c-0410-a6c6-c2d559e19af0
  • Loading branch information
lucboudreau committed Aug 20, 2012
1 parent 88108fb commit 5913e32
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 3 additions & 1 deletion testsrc/org/olap4j/OlapTreeTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
*/
public class OlapTreeTest extends TestCase {

private final TestContext.Tester tester =
private TestContext.Tester tester =
TestContext.instance().getTester();

/**
Expand All @@ -45,13 +45,15 @@ public class OlapTreeTest extends TestCase {
private Connection connection;

protected void tearDown() throws Exception {
super.tearDown();
// Simple strategy to prevent connection leaks
if (connection != null
&& !connection.isClosed())
{
connection.close();
connection = null;
}
tester = null;
}

/**
Expand Down
3 changes: 2 additions & 1 deletion testsrc/org/olap4j/test/ParserTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public class ParserTest extends TestCase {
Pattern.compile(
"(?s)From line ([0-9]+), column ([0-9]+) to line ([0-9]+), column ([0-9]+): (.*)");

final TestContext testContext = TestContext.instance();
private TestContext testContext = TestContext.instance();
private Connection connection;

public ParserTest(String name) {
Expand All @@ -70,6 +70,7 @@ protected void tearDown() throws Exception {
connection.close();
connection = null;
}
testContext = null;
}

private MdxParser createParser() {
Expand Down

0 comments on commit 5913e32

Please sign in to comment.