jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r1175988 - /jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/NPEandCMETest.java
Date Mon, 26 Sep 2011 18:36:36 GMT
Author: jukka
Date: Mon Sep 26 18:36:36 2011
New Revision: 1175988

URL: http://svn.apache.org/viewvc?rev=1175988&view=rev
Log:
JCR-3063 NullPointerException in ItemManager

Clean up output from the test case


Modified:
    jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/NPEandCMETest.java

Modified: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/NPEandCMETest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/NPEandCMETest.java?rev=1175988&r1=1175987&r2=1175988&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/NPEandCMETest.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/NPEandCMETest.java
Mon Sep 26 18:36:36 2011
@@ -27,9 +27,15 @@ import javax.jcr.Session;
 
 import org.apache.jackrabbit.core.state.NoSuchItemStateException;
 import org.apache.jackrabbit.test.AbstractJCRTest;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 public class NPEandCMETest extends AbstractJCRTest {
 
+    /** Logger instance */
+    private static final Logger log =
+            LoggerFactory.getLogger(NPEandCMETest.class);
+
     private final static int NUM_THREADS = 10;
     private final static boolean SHOW_STACKTRACE = true;
     
@@ -71,8 +77,8 @@ public class NPEandCMETest extends Abstr
             npes += tasks[i].npes;
             cmes += tasks[i].cmes;
         }
-        System.err.println("Total NPEs: " + npes);
-        System.err.println("Total CMEs: " + cmes);
+        assertEquals("Total NPEs > 0", 0, npes);
+        assertEquals("Total CMEs > 0", 0, cmes);
     }
     
     private static class TestTask implements Runnable {
@@ -121,24 +127,18 @@ public class NPEandCMETest extends Abstr
                 // ignorable
             }
             catch (RepositoryException e) {
-                if (e.getCause() == null || !(e.getCause() instanceof NoSuchItemStateException))
{
-                    System.err.println("thread" + id + ":" + e);
-                    e.printStackTrace();
+                Throwable cause = e.getCause();
+                if (!(cause instanceof NoSuchItemStateException)) {
+                    log.warn("Unexpected RepositoryException caught", e);
                 }
                 // else ignorable
             }
             catch (NullPointerException e) {
-                System.err.println("====> " + e);
-                if (SHOW_STACKTRACE) {
-                    e.printStackTrace();
-                }
+                log.error("NPE caught", e);
                 npes++;
             }
             catch (ConcurrentModificationException e) {
-                System.err.println("====> " + e);
-                if (SHOW_STACKTRACE) {
-                    e.printStackTrace();
-                }
+                log.error("CME caught", e);
                 cmes++;
             }
         }



Mime
View raw message