jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mreut...@apache.org
Subject svn commit: r605509 - in /jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state: ItemState.java NodeState.java PropertyState.java SharedItemStateManager.java
Date Wed, 19 Dec 2007 10:40:37 GMT
Author: mreutegg
Date: Wed Dec 19 02:40:35 2007
New Revision: 605509

URL: http://svn.apache.org/viewvc?rev=605509&view=rev
Log:
JCR-1148: NullPointerException in ItemState

Modified:
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/ItemState.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/NodeState.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/PropertyState.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/SharedItemStateManager.java

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/ItemState.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/ItemState.java?rev=605509&r1=605508&r2=605509&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/ItemState.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/ItemState.java
Wed Dec 19 02:40:35 2007
@@ -150,17 +150,18 @@
     /**
      * Copy state information from another state into this state
      * @param state source state information
+     * @param syncModCount if the modCount should be synchronized.
      */
-    protected abstract void copy(ItemState state);
+    protected abstract void copy(ItemState state, boolean syncModCount);
 
     /**
      * Pull state information from overlayed state.
      */
     void pull() {
-        if (overlayedState != null) {
-            copy(overlayedState);
+        ItemState state = overlayedState;
+        if (state != null) {
             // sync modification count
-            modCount = overlayedState.getModCount();
+            copy(state, true);
         }
     }
 
@@ -168,8 +169,9 @@
      * Push state information into overlayed state.
      */
     void push() {
-        if (overlayedState != null) {
-            overlayedState.copy(this);
+        ItemState state = overlayedState;
+        if (state != null) {
+            state.copy(this, false);
         }
     }
 

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/NodeState.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/NodeState.java?rev=605509&r1=605508&r2=605509&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/NodeState.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/NodeState.java
Wed Dec 19 02:40:35 2007
@@ -136,7 +136,7 @@
     /**
      * {@inheritDoc}
      */
-    protected synchronized void copy(ItemState state) {
+    protected synchronized void copy(ItemState state, boolean syncModCount) {
         synchronized (state) {
             NodeState nodeState = (NodeState) state;
             id = nodeState.id;
@@ -150,6 +150,9 @@
             childNodeEntries = nodeState.childNodeEntries;
             sharedChildNodeEntries = true;
             nodeState.sharedChildNodeEntries = true;
+            if (syncModCount) {
+                setModCount(state.getModCount());
+            }
         }
     }
 

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/PropertyState.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/PropertyState.java?rev=605509&r1=605508&r2=605509&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/PropertyState.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/PropertyState.java
Wed Dec 19 02:40:35 2007
@@ -103,7 +103,7 @@
     /**
      * {@inheritDoc}
      */
-    protected synchronized void copy(ItemState state) {
+    protected synchronized void copy(ItemState state, boolean syncModCount) {
         synchronized (state) {
             PropertyState propState = (PropertyState) state;
             id = propState.id;
@@ -111,6 +111,9 @@
             defId = propState.defId;
             values = propState.values;
             multiValued = propState.multiValued;
+            if (syncModCount) {
+                setModCount(state.getModCount());
+            }
         }
     }
 

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/SharedItemStateManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/SharedItemStateManager.java?rev=605509&r1=605508&r2=605509&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/SharedItemStateManager.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/SharedItemStateManager.java
Wed Dec 19 02:40:35 2007
@@ -754,7 +754,7 @@
                 for (Iterator iter = shared.modifiedStates(); iter.hasNext();) {
                     ItemState state = (ItemState) iter.next();
                     try {
-                        state.copy(loadItemState(state.getId()));
+                        state.copy(loadItemState(state.getId()), false);
                     } catch (ItemStateException e) {
                         state.discard();
                     }
@@ -762,7 +762,7 @@
                 for (Iterator iter = shared.deletedStates(); iter.hasNext();) {
                     ItemState state = (ItemState) iter.next();
                     try {
-                        state.copy(loadItemState(state.getId()));
+                        state.copy(loadItemState(state.getId()), false);
                     } catch (ItemStateException e) {
                         state.discard();
                     }
@@ -925,8 +925,7 @@
             if (state != null) {
                 try {
                     ItemState currentState = loadItemState(state.getId());
-                    state.copy(currentState);
-                    state.setModCount(currentState.getModCount());
+                    state.copy(currentState, true);
                     shared.modified(state);
                 } catch (NoSuchItemStateException e) {
                     // This is likely to happen because a subsequent delete



Mime
View raw message