jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mreut...@apache.org
Subject svn commit: r430101 - in /jackrabbit/trunk/jackrabbit/src/test/java/org/apache/jackrabbit/test: AbstractJCRTest.java api/AbstractPropertyTest.java
Date Wed, 09 Aug 2006 17:25:48 GMT
Author: mreutegg
Date: Wed Aug  9 10:25:48 2006
New Revision: 430101

URL: http://svn.apache.org/viewvc?rev=430101&view=rev
Log:
JCR-536: Session leak in API test cases

Modified:
    jackrabbit/trunk/jackrabbit/src/test/java/org/apache/jackrabbit/test/AbstractJCRTest.java
    jackrabbit/trunk/jackrabbit/src/test/java/org/apache/jackrabbit/test/api/AbstractPropertyTest.java

Modified: jackrabbit/trunk/jackrabbit/src/test/java/org/apache/jackrabbit/test/AbstractJCRTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit/src/test/java/org/apache/jackrabbit/test/AbstractJCRTest.java?rev=430101&r1=430100&r2=430101&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit/src/test/java/org/apache/jackrabbit/test/AbstractJCRTest.java
(original)
+++ jackrabbit/trunk/jackrabbit/src/test/java/org/apache/jackrabbit/test/AbstractJCRTest.java
Wed Aug  9 10:25:48 2006
@@ -358,7 +358,7 @@
         }
     }
 
-    protected void tearDown() throws Exception {
+    protected void cleanUp() throws Exception {
         if (superuser != null) {
             try {
                 if (!isReadOnly) {
@@ -370,6 +370,10 @@
                 superuser.logout();
             }
         }
+    }
+    
+    protected void tearDown() throws Exception {
+        cleanUp();
         super.tearDown();
     }
 

Modified: jackrabbit/trunk/jackrabbit/src/test/java/org/apache/jackrabbit/test/api/AbstractPropertyTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit/src/test/java/org/apache/jackrabbit/test/api/AbstractPropertyTest.java?rev=430101&r1=430100&r2=430101&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit/src/test/java/org/apache/jackrabbit/test/api/AbstractPropertyTest.java
(original)
+++ jackrabbit/trunk/jackrabbit/src/test/java/org/apache/jackrabbit/test/api/AbstractPropertyTest.java
Wed Aug  9 10:25:48 2006
@@ -57,6 +57,7 @@
 
         prop = PropertyUtil.searchProp(session, session.getRootNode().getNode(testPath),
getPropertyType());
         if (prop == null) {
+            cleanUp();
             String msg = "Workspace does not contain a node with a " +
                     PropertyType.nameFromValue(getPropertyType()) + " property.";
             throw new NotExecutableException(msg);
@@ -64,19 +65,26 @@
         multiple = prop.getDefinition().isMultiple();
         Value val = PropertyUtil.getValue(prop);
         if (val == null) {
+            cleanUp();
             String msg = PropertyType.nameFromValue(getPropertyType()) +
                     " property does not contain a value";
             throw new NotExecutableException(msg);
         }
     }
 
+    protected void cleanUp() throws Exception {
+        if (session != null) {
+            session.logout();
+        }
+        super.cleanUp();
+    }
+    
+    
     /**
      * Releases the session aquired in {@link #setUp()}.
      */
     protected void tearDown() throws Exception {
-        if (session != null) {
-            session.logout();
-        }
+        cleanUp();
         super.tearDown();
     }
 }



Mime
View raw message