jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Dürig <mdue...@apache.org>
Subject Re: svn commit: r1342275 - in /jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr: ItemDelegate.java NodeDelegate.java NodeImpl.java PropertyDelegate.java PropertyImpl.java
Date Thu, 24 May 2012 14:25:32 GMT

Hi,

This should be OAK-115 but JIRA was down virtually the entire afternoon. 
Is there any way to retro fit the commit message?

Michael

On 24.5.12 15:04, mduerig@apache.org wrote:
> Author: mduerig
> Date: Thu May 24 14:04:17 2012
> New Revision: 1342275
>
> URL: http://svn.apache.org/viewvc?rev=1342275&view=rev
> Log:
> OAK-???: ItemDelegate and sub classes should throw IllegalItemStateException on stale
items instead of relying on the consumer API to check staleness upfront
> (sorry no issue number, JIRA is down)
>
> Modified:
>      jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/ItemDelegate.java
>      jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/NodeDelegate.java
>      jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/NodeImpl.java
>      jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/PropertyDelegate.java
>      jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/PropertyImpl.java
>
> Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/ItemDelegate.java
> URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/ItemDelegate.java?rev=1342275&r1=1342274&r2=1342275&view=diff
> ==============================================================================
> --- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/ItemDelegate.java
(original)
> +++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/ItemDelegate.java
Thu May 24 14:04:17 2012
> @@ -17,10 +17,11 @@
>
>   package org.apache.jackrabbit.oak.jcr;
>
> +import org.apache.jackrabbit.oak.api.Tree.Status;
> +
>   import javax.annotation.CheckForNull;
>   import javax.annotation.Nonnull;
> -
> -import org.apache.jackrabbit.oak.api.Tree.Status;
> +import javax.jcr.InvalidItemStateException;
>
>   /**
>    * Abstract base class for {@link NodeDelegate} and {@link PropertyDelegate}
> @@ -30,6 +31,8 @@ public abstract class ItemDelegate {
>       protected final SessionDelegate sessionDelegate;
>
>       protected ItemDelegate(SessionDelegate sessionDelegate) {
> +        assert sessionDelegate != null;
> +
>           this.sessionDelegate = sessionDelegate;
>       }
>
> @@ -38,21 +41,21 @@ public abstract class ItemDelegate {
>        * @return oak name of this item
>        */
>       @Nonnull
> -    public abstract String getName();
> +    public abstract String getName() throws InvalidItemStateException;
>
>       /**
>        * Get the path of this item
>        * @return oak path of this item
>        */
>       @Nonnull
> -    public abstract String getPath();
> +    public abstract String getPath() throws InvalidItemStateException;
>
>       /**
>        * Get the parent of this item
>        * @return  parent of this item or {@code null} for root
>        */
>       @CheckForNull
> -    public abstract NodeDelegate getParent();
> +    public abstract NodeDelegate getParent() throws InvalidItemStateException;
>
>       /**
>        * Determine whether this item is stale
> @@ -65,12 +68,14 @@ public abstract class ItemDelegate {
>        * @return  {@link Status} of this item
>        */
>       @Nonnull
> -    public abstract Status getStatus();
> +    public abstract Status getStatus() throws InvalidItemStateException;
>
>       /**
>        * Get the session delegate with which this item is associated
>        * @return  {@link SessionDelegate} to which this item belongs
>        */
>       @Nonnull
> -    public abstract SessionDelegate getSessionDelegate();
> +    public SessionDelegate getSessionDelegate() {
> +        return sessionDelegate;
> +    }
>   }
>
> Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/NodeDelegate.java
> URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/NodeDelegate.java?rev=1342275&r1=1342274&r2=1342275&view=diff
> ==============================================================================
> --- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/NodeDelegate.java
(original)
> +++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/NodeDelegate.java
Thu May 24 14:04:17 2012
> @@ -26,16 +26,15 @@ import org.apache.jackrabbit.oak.util.It
>
>   import javax.annotation.CheckForNull;
>   import javax.annotation.Nonnull;
> +import javax.jcr.InvalidItemStateException;
>   import java.util.Iterator;
>   import java.util.List;
>
>   /**
>    * {@code NodeDelegate} serve as internal representations of {@code Node}s.
> - * The methods of this class do not throw checked exceptions. Instead clients
> - * are expected to inspect the return value and ensure that all preconditions
> - * hold before a method is invoked. Specifically the behaviour of all methods
> - * of this class but {@link #isStale()} is undefined if the instance is stale.
> - * An item is stale if the underlying items does not exist anymore.
> + * Most methods of this class throw an {@code InvalidItemStateException}
> + * exception if the instance is stale. An instance is stale if the underlying
> + * items does not exist anymore.
>    */
>   public class NodeDelegate extends ItemDelegate {
>
> @@ -52,28 +51,29 @@ public class NodeDelegate extends ItemDe
>       }
>
>       @Override
> -    public String getName() {
> +    public String getName() throws InvalidItemStateException {
>           return getTree().getName();
>       }
>
>       @Override
> -    public String getPath() {
> +    public String getPath() throws InvalidItemStateException {
>           return '/' + getTree().getPath();
>       }
>
>       @Override
> -    public NodeDelegate getParent() {
> +    public NodeDelegate getParent() throws InvalidItemStateException {
>           Tree parent = getParentTree();
>           return parent == null ? null : new NodeDelegate(sessionDelegate, parent);
>       }
>
>       @Override
>       public boolean isStale() {
> -        return getTree() == null;
> +        resolve();
> +        return tree == null;
>       }
>
>       @Override
> -    public Status getStatus() {
> +    public Status getStatus() throws InvalidItemStateException {
>           Tree parent = getParentTree();
>           if (parent == null) {
>               return Status.EXISTING;  // FIXME: return correct status for root
> @@ -84,17 +84,12 @@ public class NodeDelegate extends ItemDe
>       }
>
>       @Override
> -    public SessionDelegate getSessionDelegate() {
> -        return sessionDelegate;
> -    }
> -
> -    @Override
>       public String toString() {
>           // don't disturb the state: avoid calling getTree()
>           return "NodeDelegate[/" + tree.getPath() + ']';
>       }
>
> -    public String getIdentifier() {
> +    public String getIdentifier() throws InvalidItemStateException {
>           PropertyDelegate pd = getProperty("jcr:uuid");
>           if (pd == null) {
>               return getPath();
> @@ -108,7 +103,7 @@ public class NodeDelegate extends ItemDe
>        * Determine whether this is the root node
>        * @return  {@code true} iff this is the root node
>        */
> -    public boolean isRoot() {
> +    public boolean isRoot() throws InvalidItemStateException {
>           return getParentTree() == null;
>       }
>
> @@ -116,7 +111,7 @@ public class NodeDelegate extends ItemDe
>        * Get the number of properties of the node
>        * @return  number of properties of the node
>        */
> -    public long getPropertyCount() {
> +    public long getPropertyCount() throws InvalidItemStateException {
>           return getTree().getPropertyCount();
>       }
>
> @@ -127,7 +122,7 @@ public class NodeDelegate extends ItemDe
>        * no such property exists
>        */
>       @CheckForNull
> -    public PropertyDelegate getProperty(String relPath) {
> +    public PropertyDelegate getProperty(String relPath) throws InvalidItemStateException
{
>           Tree parent = getTree(PathUtils.getParentPath(relPath));
>           if (parent == null) {
>               return null;
> @@ -144,7 +139,7 @@ public class NodeDelegate extends ItemDe
>        * Get the properties of the node
>        * @return  properties of the node
>        */
> -    public Iterator<PropertyDelegate>  getProperties() {
> +    public Iterator<PropertyDelegate>  getProperties() throws InvalidItemStateException
{
>           return propertyDelegateIterator(getTree().getProperties().iterator());
>       }
>
> @@ -152,7 +147,7 @@ public class NodeDelegate extends ItemDe
>        * Get the number of child nodes
>        * @return  number of child nodes of the node
>        */
> -    public long getChildCount() {
> +    public long getChildCount() throws InvalidItemStateException {
>           return getTree().getChildrenCount();
>       }
>
> @@ -163,7 +158,7 @@ public class NodeDelegate extends ItemDe
>        * no such node exists
>        */
>       @CheckForNull
> -    public NodeDelegate getChild(String relPath) {
> +    public NodeDelegate getChild(String relPath) throws InvalidItemStateException {
>           Tree tree = getTree(relPath);
>           return tree == null ? null : new NodeDelegate(sessionDelegate, tree);
>       }
> @@ -172,7 +167,7 @@ public class NodeDelegate extends ItemDe
>        * Get child nodes
>        * @return  child nodes of the node
>        */
> -    public Iterator<NodeDelegate>  getChildren() {
> +    public Iterator<NodeDelegate>  getChildren() throws InvalidItemStateException
{
>           return nodeDelegateIterator(getTree().getChildren().iterator());
>       }
>
> @@ -183,7 +178,7 @@ public class NodeDelegate extends ItemDe
>        * @return  the set property
>        */
>       @Nonnull
> -    public PropertyDelegate setProperty(String name, CoreValue value) {
> +    public PropertyDelegate setProperty(String name, CoreValue value) throws InvalidItemStateException
{
>           PropertyState propertyState = getTree().setProperty(name, value);
>           return new PropertyDelegate(sessionDelegate, getTree(), propertyState);
>       }
> @@ -195,7 +190,7 @@ public class NodeDelegate extends ItemDe
>        * @return  the set property
>        */
>       @Nonnull
> -    public PropertyDelegate setProperty(String name, List<CoreValue>  value) {
> +    public PropertyDelegate setProperty(String name, List<CoreValue>  value) throws
InvalidItemStateException {
>           PropertyState propertyState = getTree().setProperty(name, value);
>           return new PropertyDelegate(sessionDelegate, getTree(), propertyState);
>       }
> @@ -206,7 +201,7 @@ public class NodeDelegate extends ItemDe
>        * @return  the added node or {@code null} if such a node already exists
>        */
>       @CheckForNull
> -    public NodeDelegate addChild(String name) {
> +    public NodeDelegate addChild(String name) throws InvalidItemStateException {
>           Tree tree = getTree();
>           return tree.hasChild(name)
>               ? null
> @@ -216,13 +211,13 @@ public class NodeDelegate extends ItemDe
>       /**
>        * Remove the node
>        */
> -    public void remove() {
> +    public void remove() throws InvalidItemStateException {
>           getParentTree().removeChild(getName());
>       }
>
>       // -----------------------------------------------------------<  private>---
>
> -    private Tree getTree(String relPath) {
> +    private Tree getTree(String relPath) throws InvalidItemStateException {
>           Tree tree = getTree();
>           for (String name : PathUtils.elements(relPath)) {
>               if (tree == null) {
> @@ -233,13 +228,23 @@ public class NodeDelegate extends ItemDe
>           return tree;
>       }
>
> -    private Tree getParentTree() {
> +    private Tree getParentTree() throws InvalidItemStateException {
>           return getTree().getParent();
>       }
>
> -    private synchronized Tree getTree() {
> -        // TODO: this should not be necessary anymore once TreeImpl.revert and TreeImpl.saved
are implemented
> -        return tree = sessionDelegate.getTree(tree.getPath());
> +    private synchronized Tree getTree() throws InvalidItemStateException {
> +        resolve();
> +        if (tree == null) {
> +            throw new InvalidItemStateException("Node is stale");
> +        }
> +
> +        return tree;
> +    }
> +
> +    private synchronized void resolve() {
> +        if (tree != null) {
> +            tree = sessionDelegate.getTree(tree.getPath());
> +        }
>       }
>
>       private Iterator<NodeDelegate>  nodeDelegateIterator(
>
> Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/NodeImpl.java
> URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/NodeImpl.java?rev=1342275&r1=1342274&r2=1342275&view=diff
> ==============================================================================
> --- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/NodeImpl.java
(original)
> +++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/NodeImpl.java
Thu May 24 14:04:17 2012
> @@ -33,6 +33,7 @@ import org.slf4j.LoggerFactory;
>
>   import javax.annotation.Nonnull;
>   import javax.jcr.Binary;
> +import javax.jcr.InvalidItemStateException;
>   import javax.jcr.Item;
>   import javax.jcr.ItemExistsException;
>   import javax.jcr.ItemNotFoundException;
> @@ -110,7 +111,12 @@ public class NodeImpl extends ItemImpl i
>        */
>       @Override
>       public boolean isNew() {
> -        return !dlg.isStale()&&  dlg.getStatus() == Status.NEW;
> +        try {
> +            return !dlg.isStale()&&  dlg.getStatus() == Status.NEW;
> +        }
> +        catch (InvalidItemStateException e) {
> +            return false;
> +        }
>       }
>
>       /**
> @@ -118,7 +124,12 @@ public class NodeImpl extends ItemImpl i
>        */
>       @Override
>       public boolean isModified() {
> -        return !dlg.isStale()&&  dlg.getStatus() == Status.MODIFIED;
> +        try {
> +            return !dlg.isStale()&&  dlg.getStatus() == Status.MODIFIED;
> +        }
> +        catch (InvalidItemStateException e) {
> +            return false;
> +        }
>       }
>
>       /**
> @@ -420,8 +431,13 @@ public class NodeImpl extends ItemImpl i
>                   new Predicate<NodeDelegate>() {
>                       @Override
>                       public boolean evaluate(NodeDelegate state) {
> -                        return ItemNameMatcher.matches(
> -                                toJcrPath(state.getName()), namePattern);
> +                        try {
> +                            return ItemNameMatcher.matches(
> +                                    toJcrPath(state.getName()), namePattern);
> +                        }
> +                        catch (InvalidItemStateException e) {
> +                            return false;
> +                        }
>                       }
>                   });
>
> @@ -437,7 +453,12 @@ public class NodeImpl extends ItemImpl i
>                   new Predicate<NodeDelegate>() {
>                       @Override
>                       public boolean evaluate(NodeDelegate state) {
> -                        return ItemNameMatcher.matches(toJcrPath(state.getName()), nameGlobs);
> +                        try {
> +                            return ItemNameMatcher.matches(toJcrPath(state.getName()),
nameGlobs);
> +                        }
> +                        catch (InvalidItemStateException e) {
> +                            return false;
> +                        }
>                       }
>                   });
>
> @@ -476,8 +497,13 @@ public class NodeImpl extends ItemImpl i
>                   new Predicate<PropertyDelegate>() {
>                       @Override
>                       public boolean evaluate(PropertyDelegate entry) {
> -                        return ItemNameMatcher.matches(
> -                                toJcrPath(entry.getName()), namePattern);
> +                        try {
> +                            return ItemNameMatcher.matches(
> +                                    toJcrPath(entry.getName()), namePattern);
> +                        }
> +                        catch (InvalidItemStateException e) {
> +                            return false;
> +                        }
>                       }
>                   });
>
> @@ -493,8 +519,13 @@ public class NodeImpl extends ItemImpl i
>                   new Predicate<PropertyDelegate>() {
>                       @Override
>                       public boolean evaluate(PropertyDelegate entry) {
> -                        return ItemNameMatcher.matches(
> -                                toJcrPath(entry.getName()), nameGlobs);
> +                        try {
> +                            return ItemNameMatcher.matches(
> +                                    toJcrPath(entry.getName()), nameGlobs);
> +                        }
> +                        catch (InvalidItemStateException e) {
> +                            return false;
> +                        }
>                       }
>                   });
>
>
> Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/PropertyDelegate.java
> URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/PropertyDelegate.java?rev=1342275&r1=1342274&r2=1342275&view=diff
> ==============================================================================
> --- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/PropertyDelegate.java
(original)
> +++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/PropertyDelegate.java
Thu May 24 14:04:17 2012
> @@ -23,6 +23,7 @@ import org.apache.jackrabbit.oak.api.Tre
>   import org.apache.jackrabbit.oak.commons.PathUtils;
>
>   import javax.annotation.Nonnull;
> +import javax.jcr.InvalidItemStateException;
>   import javax.jcr.Value;
>   import javax.jcr.nodetype.NodeType;
>   import javax.jcr.nodetype.PropertyDefinition;
> @@ -30,11 +31,9 @@ import java.util.List;
>
>   /**
>    * {@code PropertyDelegate} serve as internal representations of {@code Property}s.
> - * The methods of this class do not throw checked exceptions. Instead clients
> - * are expected to inspect the return value and ensure that all preconditions
> - * hold before a method is invoked. Specifically the behaviour of all methods
> - * of this class but {@link #isStale()} is undefined if the instance is stale.
> - * An item is stale if the underlying items does not exist anymore.
> + * Most methods of this class throw an {@code InvalidItemStateException}
> + * exception if the instance is stale. An instance is stale if the underlying
> + * items does not exist anymore.
>    */
>   public class PropertyDelegate extends ItemDelegate {
>
> @@ -59,37 +58,33 @@ public class PropertyDelegate extends It
>       }
>
>       @Override
> -    public String getName() {
> +    public String getName() throws InvalidItemStateException {
>           return getPropertyState().getName();
>       }
>
>       @Override
> -    public String getPath() {
> +    public String getPath() throws InvalidItemStateException {
>           return getParent().getPath() + '/' + getName();
>       }
>
>       @Override
>       @Nonnull
> -    public NodeDelegate getParent() {
> +    public NodeDelegate getParent() throws InvalidItemStateException {
>           return new NodeDelegate(sessionDelegate, getParentTree());
>       }
>
>       @Override
>       public boolean isStale() {
> -        return getPropertyState() == null;
> +        resolve();
> +        return parent == null;
>       }
>
>       @Override
> -    public Status getStatus() {
> +    public Status getStatus() throws InvalidItemStateException {
>           return getParentTree().getPropertyStatus(getName());
>       }
>
>       @Override
> -    public SessionDelegate getSessionDelegate() {
> -        return sessionDelegate;
> -    }
> -
> -    @Override
>       public String toString() {
>           // don't disturb the state: avoid calling resolve()
>           return "PropertyDelegate[/" + parent.getPath() + '/' + propertyState.getName()
+ ']';
> @@ -99,7 +94,7 @@ public class PropertyDelegate extends It
>        * Get the value of the property
>        * @return  value or {@code null} if multi values
>        */
> -    public CoreValue getValue() {
> +    public CoreValue getValue() throws InvalidItemStateException {
>           PropertyState state = getPropertyState();
>           return state.isArray() ? null : state.getValue();
>       }
> @@ -108,7 +103,7 @@ public class PropertyDelegate extends It
>        * Get the value of the property
>        * @return  value or {@code null} if single valued
>        */
> -    public Iterable<CoreValue>  getValues() {
> +    public Iterable<CoreValue>  getValues() throws InvalidItemStateException {
>           PropertyState state = getPropertyState();
>           return state == null ? null : state.getValues();
>       }
> @@ -117,7 +112,7 @@ public class PropertyDelegate extends It
>        * Determine whether the property is multi valued
>        * @return  {@code true} if multi valued
>        */
> -    public boolean isMultivalue() {
> +    public boolean isMultivalue() throws InvalidItemStateException {
>           return getPropertyState().isArray();
>       }
>
> @@ -149,7 +144,12 @@ public class PropertyDelegate extends It
>               @Override
>               public boolean isMultiple() {
>                   // TODO
> -                return getPropertyState().isArray();
> +                try {
> +                    return getPropertyState().isArray();
> +                }
> +                catch (InvalidItemStateException e) {
> +                    return false;  // todo implement catch e
> +                }
>               }
>
>               @Override
> @@ -179,7 +179,12 @@ public class PropertyDelegate extends It
>               @Override
>               public String getName() {
>                   // TODO
> -                return getPropertyState().getName();
> +                try {
> +                    return getPropertyState().getName();
> +                }
> +                catch (InvalidItemStateException e) {
> +                    return null;  // todo implement catch e
> +                }
>               }
>
>               @Override
> @@ -212,7 +217,7 @@ public class PropertyDelegate extends It
>        * Set the value of the property
>        * @param value
>        */
> -    public void setValue(CoreValue value) {
> +    public void setValue(CoreValue value) throws InvalidItemStateException {
>           getParentTree().setProperty(getName(), value);
>       }
>
> @@ -220,38 +225,47 @@ public class PropertyDelegate extends It
>        * Set the values of the property
>        * @param values
>        */
> -    public void setValues(List<CoreValue>  values) {
> +    public void setValues(List<CoreValue>  values) throws InvalidItemStateException
{
>           getParentTree().setProperty(getName(), values);
>       }
>
>       /**
>        * Remove the property
>        */
> -    public void remove() {
> +    public void remove() throws InvalidItemStateException {
>           getParentTree().removeProperty(getName());
>       }
>
>       //------------------------------------------------------------<  private>---
>
> -    private PropertyState getPropertyState() {
> +    private PropertyState getPropertyState() throws InvalidItemStateException {
>           resolve();
> +        if (parent == null) {
> +            throw new InvalidItemStateException("Property is stale");
> +        }
> +
>           return propertyState;
>       }
>
> -    private Tree getParentTree() {
> +    private Tree getParentTree() throws InvalidItemStateException {
>           resolve();
> +        if (parent == null) {
> +            throw new InvalidItemStateException("Property is stale");
> +        }
> +
>           return parent;
>       }
>
>       private synchronized void resolve() {
> -        // TODO: this should not be necessary anymore once TreeImpl.revert and TreeImpl.saved
are implemented
> -        parent = sessionDelegate.getTree(parent.getPath());
> +        if (parent != null) {
> +            parent = sessionDelegate.getTree(parent.getPath());
>
> -        if (parent == null) {
> -            propertyState = null;
> -        } else {
> -            String path = PathUtils.concat(parent.getPath(), propertyState.getName());
> -            propertyState = parent.getProperty(PathUtils.getName(path));
> +            if (parent == null) {
> +                propertyState = null;
> +            } else {
> +                String path = PathUtils.concat(parent.getPath(), propertyState.getName());
> +                propertyState = parent.getProperty(PathUtils.getName(path));
> +            }
>           }
>       }
>
>
> Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/PropertyImpl.java
> URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/PropertyImpl.java?rev=1342275&r1=1342274&r2=1342275&view=diff
> ==============================================================================
> --- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/PropertyImpl.java
(original)
> +++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/PropertyImpl.java
Thu May 24 14:04:17 2012
> @@ -24,6 +24,7 @@ import org.slf4j.LoggerFactory;
>
>   import javax.annotation.Nonnull;
>   import javax.jcr.Binary;
> +import javax.jcr.InvalidItemStateException;
>   import javax.jcr.ItemNotFoundException;
>   import javax.jcr.ItemVisitor;
>   import javax.jcr.Node;
> @@ -80,7 +81,12 @@ public class PropertyImpl extends ItemIm
>        */
>       @Override
>       public boolean isNew() {
> -        return dlg.getStatus() == Status.NEW;
> +        try {
> +            return dlg.getStatus() == Status.NEW;
> +        }
> +        catch (InvalidItemStateException e) {
> +            return false;
> +        }
>       }
>
>       /**
> @@ -88,7 +94,12 @@ public class PropertyImpl extends ItemIm
>        */
>       @Override
>       public boolean isModified() {
> -        return dlg.getStatus() == Status.MODIFIED;
> +        try {
> +            return dlg.getStatus() == Status.MODIFIED;
> +        }
> +        catch (InvalidItemStateException e) {
> +            return false;
> +        }
>       }
>
>       /**
>
>

Mime
View raw message