jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mreut...@apache.org
Subject svn commit: r745824 - in /jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core: RepositoryImpl.java observation/DelegatingObservationDispatcher.java observation/EventStateCollection.java observation/ObservationManagerImpl.java
Date Thu, 19 Feb 2009 11:39:19 GMT
Author: mreutegg
Date: Thu Feb 19 11:39:18 2009
New Revision: 745824

URL: http://svn.apache.org/viewvc?rev=745824&view=rev
Log:
JCR-1949: NullPointerException on DelegatingObservationDispatcher cause by parameter null
on call : createEventStateCollection(null)

Modified:
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/RepositoryImpl.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/observation/DelegatingObservationDispatcher.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/observation/EventStateCollection.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/observation/ObservationManagerImpl.java

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/RepositoryImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/RepositoryImpl.java?rev=745824&r1=745823&r2=745824&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/RepositoryImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/RepositoryImpl.java
Thu Feb 19 11:39:18 2009
@@ -2151,7 +2151,8 @@
                                    String userData) throws RepositoryException {
             try {
                 EventStateCollection esc = new EventStateCollection(
-                        getObservationDispatcher(), null, null, userData);
+                        getObservationDispatcher(), null, null);
+                esc.setUserData(userData);
                 esc.addAll(events);
                 esc.setTimestamp(timestamp);
 

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/observation/DelegatingObservationDispatcher.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/observation/DelegatingObservationDispatcher.java?rev=745824&r1=745823&r2=745824&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/observation/DelegatingObservationDispatcher.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/observation/DelegatingObservationDispatcher.java
Thu Feb 19 11:39:18 2009
@@ -25,8 +25,6 @@
 import java.util.HashSet;
 import java.util.List;
 
-import javax.jcr.RepositoryException;
-
 /**
  * This Class implements an observation dispatcher, that delegates events to
  * a set of underlying dispatchers.
@@ -73,16 +71,9 @@
      * @param pathPrefix event path prefix
      * @return new <code>EventStateCollection</code> instance
      */
-    public EventStateCollection createEventStateCollection(SessionImpl session,
-                                                           Path pathPrefix) {
-        String userData = null;
-        try {
-            userData = ((ObservationManagerImpl) session.getWorkspace().getObservationManager()).getUserData();
-        } catch (RepositoryException e) {
-            // should never happen because this
-            // implementation supports observation
-        }
-        return new EventStateCollection(this, session, pathPrefix, userData);
+    public EventStateCollection createEventStateCollection(
+            SessionImpl session, Path pathPrefix) {
+        return new EventStateCollection(this, session, pathPrefix);
     }
 
     //------------------------------------------------------< EventDispatcher >
@@ -128,8 +119,8 @@
         }
         for (int i = 0; i < disp.length; i++) {
             EventStateCollection events =
-                    new EventStateCollection(disp[i], session,
-                            pathPrefix, userData);
+                    new EventStateCollection(disp[i], session, pathPrefix);
+            events.setUserData(userData);
             try {
                 events.addAll(eventList);
                 events.prepare();

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/observation/EventStateCollection.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/observation/EventStateCollection.java?rev=745824&r1=745823&r2=745824&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/observation/EventStateCollection.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/observation/EventStateCollection.java
Thu Feb 19 11:39:18 2009
@@ -37,6 +37,8 @@
 
 import javax.jcr.PathNotFoundException;
 import javax.jcr.RepositoryException;
+import javax.jcr.observation.ObservationManager;
+
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Iterator;
@@ -109,16 +111,26 @@
      * @param session    the session that created these events.
      * @param pathPrefix the path to prefix the event paths or <code>null</code>
      *                   if no prefix should be used.
-     * @param userData   the user data attached to this event state collection.
      */
     public EventStateCollection(EventDispatcher dispatcher,
                                 SessionImpl session,
-                                Path pathPrefix,
-                                String userData) {
+                                Path pathPrefix) {
         this.dispatcher = dispatcher;
         this.session = session;
         this.pathPrefix = pathPrefix;
-        this.userData = userData;
+        if (session != null) {
+            try {
+                ObservationManager manager =
+                    session.getWorkspace().getObservationManager();
+                this.userData = ((ObservationManagerImpl) manager).getUserData();
+            } catch (RepositoryException e) {
+                // should never happen because this
+                // implementation supports observation
+                this.userData = null;
+            }
+        } else {
+            this.userData = null;
+        }
     }
 
     /**

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/observation/ObservationManagerImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/observation/ObservationManagerImpl.java?rev=745824&r1=745823&r2=745824&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/observation/ObservationManagerImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/observation/ObservationManagerImpl.java
Thu Feb 19 11:39:18 2009
@@ -229,6 +229,8 @@
      * which is attached to this <code>ObservationManager</code> instance.
      */
     public EventStateCollection createEventStateCollection() {
-        return new EventStateCollection(dispatcher, session, null, userData);
+        EventStateCollection esc = new EventStateCollection(dispatcher, session, null);
+        esc.setUserData(userData);
+        return esc;
     }
 }



Mime
View raw message