jspwiki-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jalka...@apache.org
Subject svn commit: r829943 - in /incubator/jspwiki/trunk/tests/java/org/apache/wiki/auth: authorize/JDBCGroupDatabaseTest.java user/XMLUserDatabaseTest.java
Date Mon, 26 Oct 2009 20:37:17 GMT
Author: jalkanen
Date: Mon Oct 26 20:37:17 2009
New Revision: 829943

URL: http://svn.apache.org/viewvc?rev=829943&view=rev
Log:
Fixed to call shutdown() properly in case either tearDown() or setUp() fail.

Modified:
    incubator/jspwiki/trunk/tests/java/org/apache/wiki/auth/authorize/JDBCGroupDatabaseTest.java
    incubator/jspwiki/trunk/tests/java/org/apache/wiki/auth/user/XMLUserDatabaseTest.java

Modified: incubator/jspwiki/trunk/tests/java/org/apache/wiki/auth/authorize/JDBCGroupDatabaseTest.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/tests/java/org/apache/wiki/auth/authorize/JDBCGroupDatabaseTest.java?rev=829943&r1=829942&r2=829943&view=diff
==============================================================================
--- incubator/jspwiki/trunk/tests/java/org/apache/wiki/auth/authorize/JDBCGroupDatabaseTest.java
(original)
+++ incubator/jspwiki/trunk/tests/java/org/apache/wiki/auth/authorize/JDBCGroupDatabaseTest.java
Mon Oct 26 20:37:17 2009
@@ -85,6 +85,7 @@
                                "please make sure that you have started your database "+
                                "(e.g. by running ant hsql-start)");
 
+            m_engine.shutdown();
             throw (SQLException) e.fillInStackTrace();
         }
 
@@ -95,12 +96,17 @@
 
     public void tearDown() throws Exception
     {
-        if ( m_conn != null )
+        try
+        {
+            if ( m_conn != null )
+            {
+                m_conn.close();
+            }
+        }
+        finally
         {
-            m_conn.close();
+            m_engine.shutdown();
         }
-        
-        m_engine.shutdown();
     }
 
     public void testDelete() throws WikiException

Modified: incubator/jspwiki/trunk/tests/java/org/apache/wiki/auth/user/XMLUserDatabaseTest.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/tests/java/org/apache/wiki/auth/user/XMLUserDatabaseTest.java?rev=829943&r1=829942&r2=829943&view=diff
==============================================================================
--- incubator/jspwiki/trunk/tests/java/org/apache/wiki/auth/user/XMLUserDatabaseTest.java
(original)
+++ incubator/jspwiki/trunk/tests/java/org/apache/wiki/auth/user/XMLUserDatabaseTest.java
Mon Oct 26 20:37:17 2009
@@ -64,9 +64,16 @@
   
   protected void tearDown() throws Exception
   {
-      assertEquals( 8, m_db.getWikiNames().length );
-      super.tearDown();
-      m_engine.shutdown();
+      try
+      {
+          // If this fails, shutdown() is never called unless it's wrapped in a finally block.
+          assertEquals( 8, m_db.getWikiNames().length );
+      }
+      finally
+      {
+          super.tearDown();
+          m_engine.shutdown();
+      }
   }
 
   public void testDeleteByLoginName() throws WikiSecurityException



Mime
View raw message