From 9c87751ae73ffe01fdee64c35effb90cc76000c5 Mon Sep 17 00:00:00 2001 From: Donald Woods Date: Fri, 8 Oct 2010 20:30:57 +0000 Subject: [PATCH] close streams git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@1006009 13f79535-47bb-0310-9956-ffa450edef68 --- .../persistence/common/utils/AbstractTestCase.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/common/utils/AbstractTestCase.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/common/utils/AbstractTestCase.java index 85832a883..6744870cd 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/common/utils/AbstractTestCase.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/common/utils/AbstractTestCase.java @@ -139,6 +139,7 @@ public abstract class AbstractTestCase extends AbstractCachedEMFTestCase { for (EntityManagerFactory emf : emfs.values()) { try { closeEMF(emf); + emf = null; } catch (Exception e) { e.printStackTrace(); } @@ -576,9 +577,14 @@ public abstract class AbstractTestCase extends AbstractCachedEMFTestCase { ObjectInputStream in = new ObjectInputStream(bin); Object result = in.readObject(); - if (validateEquality) { - assertEquals(orig.hashCode(), result.hashCode()); - assertEquals(orig, result); + try { + if (validateEquality) { + assertEquals(orig.hashCode(), result.hashCode()); + assertEquals(orig, result); + } + } finally { + out.close(); + in.close(); } return result;