jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dpfis...@apache.org
Subject svn commit: r656282 - /jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ItemManager.java
Date Wed, 14 May 2008 13:34:52 GMT
Author: dpfister
Date: Wed May 14 06:34:52 2008
New Revision: 656282

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

Modified:
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ItemManager.java

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ItemManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ItemManager.java?rev=656282&r1=656281&r2=656282&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ItemManager.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ItemManager.java
Wed May 14 06:34:52 2008
@@ -40,6 +40,7 @@
 import org.slf4j.LoggerFactory;
 
 import javax.jcr.AccessDeniedException;
+import javax.jcr.InvalidItemStateException;
 import javax.jcr.ItemNotFoundException;
 import javax.jcr.NamespaceException;
 import javax.jcr.NodeIterator;
@@ -310,7 +311,12 @@
      * @throws RepositoryException
      */
     private boolean canRead(ItemData data, Path path) throws AccessDeniedException, RepositoryException
{
-        if (data.getState().getStatus() == ItemState.STATUS_NEW &&
+        // JCR-1601: cached item may just have been invalidated
+        ItemState state = data.getState();
+        if (state == null) {
+            throw new InvalidItemStateException(data.getId() + ": the item does not exist
anymore");
+        }
+        if (state.getStatus() == ItemState.STATUS_NEW &&
                 !data.getDefinition().isProtected()) {
             // NEW items can always be read as long they have been added
             // through the API and NOT by the system (i.e. protected props).



Mime
View raw message