[jboss-cvs] JBossAS SVN: r71174 - trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/simpleweb/test.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Sat Mar 22 23:11:06 EDT 2008


Author: bstansberry at jboss.com
Date: 2008-03-22 23:11:06 -0400 (Sat, 22 Mar 2008)
New Revision: 71174

Modified:
   trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/simpleweb/test/JBossCacheManagerConfigurationUnitTestCase.java
Log:
Avoid JBCACHE-1312 NPE 

Modified: trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/simpleweb/test/JBossCacheManagerConfigurationUnitTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/simpleweb/test/JBossCacheManagerConfigurationUnitTestCase.java	2008-03-22 19:54:40 UTC (rev 71173)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/simpleweb/test/JBossCacheManagerConfigurationUnitTestCase.java	2008-03-23 03:11:06 UTC (rev 71174)
@@ -28,6 +28,7 @@
 
 import junit.framework.TestCase;
 
+import org.jboss.cache.CacheStatus;
 import org.jboss.cache.Fqn;
 import org.jboss.cache.pojo.PojoCache;
 import org.jboss.logging.Logger;
@@ -52,7 +53,7 @@
    private static final Logger log = Logger.getLogger(JBossCacheManagerConfigurationUnitTestCase.class);
    
    private static long testCount = System.currentTimeMillis();
-   
+
    private Set<PojoCache> caches = new HashSet<PojoCache>();
    private String tempDir;
    
@@ -73,17 +74,20 @@
       
       for (PojoCache cache : caches)
       { 
-         // Try to clean up so we avoid loading sessions 
-         // from storage in later tests
-         try
+         if (CacheStatus.STARTED.equals(cache.getCache().getCacheStatus()))
          {
-            log.info("Removing /JSESSION from " + cache.getCache().getLocalAddress());
-            cache.getCache().removeNode(Fqn.fromString("/JSESSION"));
+            // Try to clean up so we avoid loading sessions 
+            // from storage in later tests
+            try
+            {
+               log.info("Removing /JSESSION from " + cache.getCache().getLocalAddress());
+               cache.getCache().removeNode(Fqn.fromString("/JSESSION"));
+            }
+            catch (Exception e)
+            {
+               log.error("Cache " + cache + ": " + e.getMessage(), e);
+            }
          }
-         catch (Exception e)
-         {
-            log.error("Cache " + cache.getCache().getLocalAddress() + ": " + e.getMessage(), e);
-         }
          
          try
          {
@@ -92,7 +96,7 @@
          }
          catch (Exception e)
          {
-            log.error("Cache " + cache.getCache().getLocalAddress() + ": " + e.getMessage(), e);
+            log.error("Cache " + cache + ": " + e.getMessage(), e);
          }
       }
       




More information about the jboss-cvs-commits mailing list