You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jackrabbit.apache.org by st...@apache.org on 2005/06/28 14:31:46 UTC

svn commit: r202166 - in /incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core: BatchedItemOperations.java NodeImpl.java QName.java nodetype/NodeTypeDef.java query/lucene/NodeIndexer.java state/NodeState.java version/NodeStateEx.java

Author: stefan
Date: Tue Jun 28 05:31:45 2005
New Revision: 202166

URL: http://svn.apache.org/viewcvs?rev=202166&view=rev
Log:
more NodeState optimizations: 
- changed get/setPropertyNames from List to Set since the spec does not
  mandate that properties have to maintain order

Modified:
    incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/BatchedItemOperations.java
    incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/NodeImpl.java
    incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/QName.java
    incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/NodeTypeDef.java
    incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/query/lucene/NodeIndexer.java
    incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/state/NodeState.java
    incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/version/NodeStateEx.java

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/BatchedItemOperations.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/BatchedItemOperations.java?rev=202166&r1=202165&r2=202166&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/BatchedItemOperations.java (original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/BatchedItemOperations.java Tue Jun 28 05:31:45 2005
@@ -1496,40 +1496,42 @@
     private void recursiveRemoveNodeState(NodeState targetState)
             throws RepositoryException {
 
-        // remove child nodes
-        // use temp array to avoid ConcurrentModificationException
-        ArrayList tmp = new ArrayList(targetState.getChildNodeEntries());
-        // remove from tail to avoid problems with same-name siblings
-        for (int i = tmp.size() - 1; i >= 0; i--) {
-            NodeState.ChildNodeEntry entry = (NodeState.ChildNodeEntry) tmp.get(i);
-            NodeId nodeId = new NodeId(entry.getUUID());
-            try {
-                NodeState nodeState = (NodeState) stateMgr.getItemState(nodeId);
-                // check if child node can be removed
-                // (access rights, locking & versioning status);
-                // referential integrity (references) is checked
-                // on commit
-                checkRemoveNode(nodeState, (NodeId) targetState.getId(),
-                        CHECK_ACCESS
-                        | CHECK_LOCK
-                        | CHECK_VERSIONING);
-                // remove child node
-                recursiveRemoveNodeState(nodeState);
-            } catch (ItemStateException ise) {
-                String msg = "internal error: failed to retrieve state of "
-                        + nodeId;
-                log.debug(msg);
-                throw new RepositoryException(msg, ise);
+        if (targetState.hasChildNodeEntries()) {
+            // remove child nodes
+            // use temp array to avoid ConcurrentModificationException
+            ArrayList tmp = new ArrayList(targetState.getChildNodeEntries());
+            // remove from tail to avoid problems with same-name siblings
+            for (int i = tmp.size() - 1; i >= 0; i--) {
+                NodeState.ChildNodeEntry entry = (NodeState.ChildNodeEntry) tmp.get(i);
+                NodeId nodeId = new NodeId(entry.getUUID());
+                try {
+                    NodeState nodeState = (NodeState) stateMgr.getItemState(nodeId);
+                    // check if child node can be removed
+                    // (access rights, locking & versioning status);
+                    // referential integrity (references) is checked
+                    // on commit
+                    checkRemoveNode(nodeState, (NodeId) targetState.getId(),
+                            CHECK_ACCESS
+                            | CHECK_LOCK
+                            | CHECK_VERSIONING);
+                    // remove child node
+                    recursiveRemoveNodeState(nodeState);
+                } catch (ItemStateException ise) {
+                    String msg = "internal error: failed to retrieve state of "
+                            + nodeId;
+                    log.debug(msg);
+                    throw new RepositoryException(msg, ise);
+                }
+                // remove child node entry
+                targetState.removeChildNodeEntry(entry.getName(), entry.getIndex());
             }
-            // remove child node entry
-            targetState.removeChildNodeEntry(entry.getName(), entry.getIndex());
         }
 
         // remove properties
-        // use temp array to avoid ConcurrentModificationException
-        tmp = new ArrayList(targetState.getPropertyNames());
-        for (int i = 0; i < tmp.size(); i++) {
-            QName propName = (QName) tmp.get(i);
+        // use temp set to avoid ConcurrentModificationException
+        HashSet tmp = new HashSet(targetState.getPropertyNames());
+        for (Iterator iter = tmp.iterator(); iter.hasNext();) {
+            QName propName = (QName) iter.next();
             PropertyId propId =
                     new PropertyId(targetState.getUUID(), propName);
             try {

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/NodeImpl.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/NodeImpl.java?rev=202166&r1=202165&r2=202166&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/NodeImpl.java (original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/NodeImpl.java Tue Jun 28 05:31:45 2005
@@ -644,10 +644,10 @@
         }
 
         // remove properties
-        // use temp array to avoid ConcurrentModificationException
-        ArrayList tmp = new ArrayList(thisState.getPropertyNames());
-        for (int i = 0; i < tmp.size(); i++) {
-            QName propName = (QName) tmp.get(i);
+        // use temp set to avoid ConcurrentModificationException
+        HashSet tmp = new HashSet(thisState.getPropertyNames());
+        for (Iterator iter = tmp.iterator(); iter.hasNext();) {
+            QName propName = (QName) iter.next();
             // remove the property entry
             thisState.removePropertyName(propName);
             // remove property
@@ -1136,10 +1136,9 @@
         // walk through properties and child nodes and remove those that have been
         // defined by the specified mixin type
 
-        // use temp array to avoid ConcurrentModificationException
-        ArrayList tmp = new ArrayList(thisState.getPropertyNames());
-        Iterator iter = tmp.iterator();
-        while (iter.hasNext()) {
+        // use temp set to avoid ConcurrentModificationException
+        HashSet set = new HashSet(thisState.getPropertyNames());
+        for (Iterator iter = set.iterator(); iter.hasNext();) {
             QName propName = (QName) iter.next();
             PropertyImpl prop = (PropertyImpl) itemMgr.getItem(new PropertyId(thisState.getUUID(), propName));
             // check if property has been defined by mixin type (or one of its supertypes)
@@ -1152,9 +1151,8 @@
             }
         }
         // use temp array to avoid ConcurrentModificationException
-        tmp = new ArrayList(thisState.getChildNodeEntries());
-        iter = tmp.iterator();
-        while (iter.hasNext()) {
+        ArrayList list = new ArrayList(thisState.getChildNodeEntries());
+        for (Iterator iter = list.iterator(); iter.hasNext();) {
             NodeState.ChildNodeEntry entry = (NodeState.ChildNodeEntry) iter.next();
             NodeImpl node = (NodeImpl) itemMgr.getItem(new NodeId(entry.getUUID()));
             // check if node has been defined by mixin type (or one of its supertypes)

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/QName.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/QName.java?rev=202166&r1=202165&r2=202166&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/QName.java (original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/QName.java Tue Jun 28 05:31:45 2005
@@ -59,6 +59,8 @@
     /** Serialization UID of this class. */
     static final long serialVersionUID = -2712313010017755368L;
 
+    public static final QName[] EMPTY_ARRAY = new QName[0];
+
     /**
      * The reqular expression pattern used to validate and parse
      * qualified names.

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/NodeTypeDef.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/NodeTypeDef.java?rev=202166&r1=202165&r2=202166&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/NodeTypeDef.java (original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/nodetype/NodeTypeDef.java Tue Jun 28 05:31:45 2005
@@ -44,9 +44,9 @@
     public NodeTypeDef() {
         dependencies = null;
         name = null;
-        nodeDefs = new NodeDef[0];
-        propDefs = new PropDef[0];
-        supertypes = new QName[0];
+        nodeDefs = NodeDef.EMPTY_ARRAY;
+        propDefs = PropDef.EMPTY_ARRAY;
+        supertypes = QName.EMPTY_ARRAY;
         mixin = false;
         orderableChildNodes = false;
     }

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/query/lucene/NodeIndexer.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/query/lucene/NodeIndexer.java?rev=202166&r1=202165&r2=202166&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/query/lucene/NodeIndexer.java (original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/query/lucene/NodeIndexer.java Tue Jun 28 05:31:45 2005
@@ -16,31 +16,31 @@
  */
 package org.apache.jackrabbit.core.query.lucene;
 
-import org.apache.lucene.document.Document;
-import org.apache.lucene.document.Field;
-import org.apache.jackrabbit.core.state.NodeState;
-import org.apache.jackrabbit.core.state.ItemStateManager;
-import org.apache.jackrabbit.core.state.NoSuchItemStateException;
-import org.apache.jackrabbit.core.state.ItemStateException;
-import org.apache.jackrabbit.core.state.PropertyState;
-import org.apache.jackrabbit.core.NodeId;
+import org.apache.jackrabbit.core.Constants;
 import org.apache.jackrabbit.core.NoPrefixDeclaredException;
+import org.apache.jackrabbit.core.NodeId;
+import org.apache.jackrabbit.core.Path;
 import org.apache.jackrabbit.core.PropertyId;
-import org.apache.jackrabbit.core.value.InternalValue;
 import org.apache.jackrabbit.core.QName;
-import org.apache.jackrabbit.core.Path;
-import org.apache.jackrabbit.core.Constants;
 import org.apache.jackrabbit.core.query.TextFilterService;
+import org.apache.jackrabbit.core.state.ItemStateException;
+import org.apache.jackrabbit.core.state.ItemStateManager;
+import org.apache.jackrabbit.core.state.NoSuchItemStateException;
+import org.apache.jackrabbit.core.state.NodeState;
+import org.apache.jackrabbit.core.state.PropertyState;
+import org.apache.jackrabbit.core.value.InternalValue;
 import org.apache.log4j.Logger;
+import org.apache.lucene.document.Document;
+import org.apache.lucene.document.Field;
 
 import javax.jcr.NamespaceException;
 import javax.jcr.PropertyType;
 import javax.jcr.RepositoryException;
+import java.io.Reader;
 import java.util.Calendar;
 import java.util.Iterator;
-import java.util.List;
 import java.util.Map;
-import java.io.Reader;
+import java.util.Set;
 
 /**
  * Creates a lucene <code>Document</code> object from a {@link javax.jcr.Node}.
@@ -91,8 +91,8 @@
      * @param mappings      internal namespace mappings.
      */
     protected NodeIndexer(NodeState node,
-                        ItemStateManager stateProvider,
-                        NamespaceMappings mappings) {
+                          ItemStateManager stateProvider,
+                          NamespaceMappings mappings) {
         this.node = node;
         this.stateProvider = stateProvider;
         this.mappings = mappings;
@@ -151,7 +151,7 @@
             // unknown uri<->prefix mappings
         }
 
-        List props = node.getPropertyNames();
+        Set props = node.getPropertyNames();
         for (Iterator it = props.iterator(); it.hasNext();) {
             QName propName = (QName) it.next();
             PropertyId id = new PropertyId(node.getUUID(), propName);
@@ -177,7 +177,8 @@
     /**
      * Adds a {@link FieldNames#MVP} field to <code>doc</code> with the resolved
      * <code>name</code> using the internal search index namespace mapping.
-     * @param doc the lucene document.
+     *
+     * @param doc  the lucene document.
      * @param name the name of the multi-value property.
      */
     private void addMVPName(Document doc, QName name) {
@@ -239,14 +240,14 @@
 
     /**
      * Adds the binary value to the document as the named field.
-     * <p>
+     * <p/>
      * This implementation checks if this {@link #node} is of type nt:resource
      * and if that is the case, tries to extract text from the data atom using
      * {@link TextFilterService}add a {@link FieldNames#FULLTEXT} field
      * .
      *
-     * @param doc The document to which to add the field
-     * @param fieldName The name of the field to add
+     * @param doc           The document to which to add the field
+     * @param fieldName     The name of the field to add
      * @param internalValue The value for the field to add to the document.
      */
     protected void addBinaryValue(Document doc, String fieldName, Object internalValue) {
@@ -260,13 +261,13 @@
             if (node.hasPropertyName(JCR_MIMETYPE)) {
                 PropertyState dataProp = (PropertyState) stateProvider.getItemState(new PropertyId(node.getUUID(), JCR_DATA));
                 PropertyState mimeTypeProp =
-                    (PropertyState) stateProvider.getItemState(new PropertyId(node.getUUID(), JCR_MIMETYPE));
+                        (PropertyState) stateProvider.getItemState(new PropertyId(node.getUUID(), JCR_MIMETYPE));
 
                 // jcr:encoding is not mandatory
                 String encoding = null;
                 if (node.hasPropertyName(JCR_ENCODING)) {
                     PropertyState encodingProp =
-                        (PropertyState) stateProvider.getItemState(new PropertyId(node.getUUID(), JCR_ENCODING));
+                            (PropertyState) stateProvider.getItemState(new PropertyId(node.getUUID(), JCR_ENCODING));
                     encodingProp.getValues()[0].internalValue().toString();
                 }
 
@@ -292,16 +293,16 @@
      * Adds the string representation of the boolean value to the document as
      * the named field.
      *
-     * @param doc The document to which to add the field
-     * @param fieldName The name of the field to add
+     * @param doc           The document to which to add the field
+     * @param fieldName     The name of the field to add
      * @param internalValue The value for the field to add to the document.
      */
     protected void addBooleanValue(Document doc, String fieldName, Object internalValue) {
         doc.add(new Field(FieldNames.PROPERTIES,
-            FieldNames.createNamedValue(fieldName, internalValue.toString()),
-            false,
-            true,
-            false));
+                FieldNames.createNamedValue(fieldName, internalValue.toString()),
+                false,
+                true,
+                false));
     }
 
     /**
@@ -309,8 +310,8 @@
      * value is converted to an indexable string value using the {@link DateField}
      * class.
      *
-     * @param doc The document to which to add the field
-     * @param fieldName The name of the field to add
+     * @param doc           The document to which to add the field
+     * @param fieldName     The name of the field to add
      * @param internalValue The value for the field to add to the document.
      */
     protected void addCalendarValue(Document doc, String fieldName, Object internalValue) {
@@ -327,8 +328,8 @@
      * value is converted to an indexable string value using the
      * {@link DoubleField} class.
      *
-     * @param doc The document to which to add the field
-     * @param fieldName The name of the field to add
+     * @param doc           The document to which to add the field
+     * @param fieldName     The name of the field to add
      * @param internalValue The value for the field to add to the document.
      */
     protected void addDoubleValue(Document doc, String fieldName, Object internalValue) {
@@ -345,8 +346,8 @@
      * value is converted to an indexable string value using the {@link LongField}
      * class.
      *
-     * @param doc The document to which to add the field
-     * @param fieldName The name of the field to add
+     * @param doc           The document to which to add the field
+     * @param fieldName     The name of the field to add
      * @param internalValue The value for the field to add to the document.
      */
     protected void addLongValue(Document doc, String fieldName, Object internalValue) {
@@ -363,8 +364,8 @@
      * string representation is added as the reference data. Additionally the
      * reference data is stored in the index.
      *
-     * @param doc The document to which to add the field
-     * @param fieldName The name of the field to add
+     * @param doc           The document to which to add the field
+     * @param fieldName     The name of the field to add
      * @param internalValue The value for the field to add to the document.
      */
     protected void addReferenceValue(Document doc, String fieldName, Object internalValue) {
@@ -381,8 +382,8 @@
      * value is converted to an indexable string value using the name space
      * mappings with which this class has been created.
      *
-     * @param doc The document to which to add the field
-     * @param fieldName The name of the field to add
+     * @param doc           The document to which to add the field
+     * @param fieldName     The name of the field to add
      * @param internalValue The value for the field to add to the document.
      */
     protected void addPathValue(Document doc, String fieldName, Object internalValue) {
@@ -404,8 +405,8 @@
      * Adds the string value to the document both as the named field and for
      * full text indexing.
      *
-     * @param doc The document to which to add the field
-     * @param fieldName The name of the field to add
+     * @param doc           The document to which to add the field
+     * @param fieldName     The name of the field to add
      * @param internalValue The value for the field to add to the document.
      */
     protected void addStringValue(Document doc, String fieldName, Object internalValue) {
@@ -426,7 +427,7 @@
         // create fulltext index on property
         int idx = fieldName.indexOf(':');
         fieldName = fieldName.substring(0, idx + 1)
-            + FieldNames.FULLTEXT_PREFIX + fieldName.substring(idx + 1);
+                + FieldNames.FULLTEXT_PREFIX + fieldName.substring(idx + 1);
         doc.add(new Field(fieldName, stringValue,
                 false,
                 true,
@@ -439,8 +440,8 @@
      * as a qualified name and mapping the name space using the name space
      * mappings with which this class has been created.
      *
-     * @param doc The document to which to add the field
-     * @param fieldName The name of the field to add
+     * @param doc           The document to which to add the field
+     * @param fieldName     The name of the field to add
      * @param internalValue The value for the field to add to the document.
      */
     protected void addNameValue(Document doc, String fieldName, Object internalValue) {

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/state/NodeState.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/state/NodeState.java?rev=202166&r1=202165&r2=202166&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/state/NodeState.java (original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/state/NodeState.java Tue Jun 28 05:31:45 2005
@@ -16,28 +16,27 @@
  */
 package org.apache.jackrabbit.core.state;
 
+import org.apache.commons.collections.MapIterator;
+import org.apache.commons.collections.map.LinkedMap;
+import org.apache.commons.collections.map.ReferenceMap;
 import org.apache.jackrabbit.core.NodeId;
 import org.apache.jackrabbit.core.QName;
 import org.apache.jackrabbit.core.nodetype.NodeDefId;
-import org.apache.commons.collections.map.ReferenceMap;
-import org.apache.commons.collections.map.LinkedMap;
-import org.apache.commons.collections.MapIterator;
-import org.apache.commons.collections.set.ListOrderedSet;
 
 import java.io.IOException;
 import java.io.ObjectInputStream;
 import java.io.ObjectOutputStream;
 import java.io.Serializable;
 import java.util.ArrayList;
+import java.util.Collection;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Iterator;
 import java.util.List;
-import java.util.Set;
-import java.util.Map;
-import java.util.Collection;
 import java.util.ListIterator;
+import java.util.Map;
+import java.util.Set;
 
 /**
  * <code>NodeState</code> represents the state of a <code>Node</code>.
@@ -45,7 +44,7 @@
 public class NodeState extends ItemState {
 
     /** Serialization UID of this class. */
-    static final long serialVersionUID = 2387880829766640392L;
+    static final long serialVersionUID = -1755253053645185279L;
 
     /** the uuid of this node */
     protected String uuid;
@@ -62,8 +61,8 @@
     /** insertion-ordered collection of ChildNodeEntry objects */
     protected ChildNodeEntries childNodeEntries = new ChildNodeEntries();
 
-    /** insertion-ordered set of property names (QName objects) */
-    protected ListOrderedSet propertyNames = new ListOrderedSet();
+    /** set of property names (QName objects) */
+    protected Set propertyNames = new HashSet();
 
     /**
      * Listeners (weak references)
@@ -415,15 +414,15 @@
     }
 
     /**
-     * Returns the names of this node's properties as a list of
+     * Returns the names of this node's properties as a set of
      * <code>QNames</code> objects.
      *
-     * @return list of <code>QNames</code> objects
+     * @return set of <code>QNames</code> objects
      * @see #addPropertyName
      * @see #removePropertyName
      */
-    public synchronized List getPropertyNames() {
-        return propertyNames.asList();
+    public synchronized Set getPropertyNames() {
+        return Collections.unmodifiableSet(propertyNames);
     }
 
     /**
@@ -454,10 +453,10 @@
     }
 
     /**
-     * Sets the list of <code>QName</code> objects denoting the
+     * Sets the set of <code>QName</code> objects denoting the
      * properties of this node.
      */
-    public synchronized void setPropertyNames(List propNames) {
+    public synchronized void setPropertyNames(Set propNames) {
         propertyNames.clear();
         propertyNames.addAll(propNames);
     }
@@ -474,22 +473,22 @@
 
     //---------------------------------------------------------< diff methods >
     /**
-     * Returns a list of <code>QName</code>s denoting those properties that
+     * Returns a set of <code>QName</code>s denoting those properties that
      * do not exist in the overlayed node state but have been added to
      * <i>this</i> node state.
      *
-     * @return list of <code>QName</code>s denoting the properties that have
+     * @return set of <code>QName</code>s denoting the properties that have
      *         been added.
      */
-    public synchronized List getAddedPropertyNames() {
+    public synchronized Set getAddedPropertyNames() {
         if (!hasOverlayedState()) {
-            return propertyNames.asList();
+            return Collections.unmodifiableSet(propertyNames);
         }
 
         NodeState other = (NodeState) getOverlayedState();
-        ArrayList list = new ArrayList(propertyNames);
-        list.removeAll(other.propertyNames);
-        return list;
+        HashSet set = new HashSet(propertyNames);
+        set.removeAll(other.propertyNames);
+        return set;
     }
 
     /**
@@ -508,22 +507,22 @@
     }
 
     /**
-     * Returns a list of <code>QName</code>s denoting those properties that
+     * Returns a set of <code>QName</code>s denoting those properties that
      * exist in the overlayed node state but have been removed from
      * <i>this</i> node state.
      *
-     * @return list of <code>QName</code>s denoting the properties that have
+     * @return set of <code>QName</code>s denoting the properties that have
      *         been removed.
      */
-    public synchronized List getRemovedPropertyNames() {
+    public synchronized Set getRemovedPropertyNames() {
         if (!hasOverlayedState()) {
-            return Collections.EMPTY_LIST;
+            return Collections.EMPTY_SET;
         }
 
         NodeState other = (NodeState) getOverlayedState();
-        ArrayList list = new ArrayList(other.propertyNames);
-        list.removeAll(propertyNames);
-        return list;
+        HashSet set = new HashSet(other.propertyNames);
+        set.removeAll(propertyNames);
+        return set;
     }
 
     /**
@@ -749,7 +748,7 @@
 
         // insertion-ordered map of entries (key=uuid, value=entry)
         LinkedMap entries;
-        // map used for lookup by name (key=uuid, value=1st same-name sibling entry)
+        // map used for lookup by name (key=name, value=1st same-name sibling entry)
         Map nameMap;
 
         ChildNodeEntries() {

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/version/NodeStateEx.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/version/NodeStateEx.java?rev=202166&r1=202165&r2=202166&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/version/NodeStateEx.java (original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/version/NodeStateEx.java Tue Jun 28 05:31:45 2005
@@ -38,6 +38,8 @@
 import javax.jcr.nodetype.NoSuchNodeTypeException;
 import java.util.List;
 import java.util.HashSet;
+import java.util.Set;
+import java.util.Iterator;
 
 /**
  * This Class provides some basic node operations directly on the node state.
@@ -131,12 +133,13 @@
      * @return
      */
     public PropertyState[] getProperties() throws ItemStateException {
-        List list = nodeState.getPropertyNames();
-        PropertyState[] props = new PropertyState[list.size()];
-        for (int i = 0; i < list.size(); i++) {
-            QName propName = (QName) list.get(i);
+        Set set = nodeState.getPropertyNames();
+        PropertyState[] props = new PropertyState[set.size()];
+        int i = 0;
+        for (Iterator iter = set.iterator(); iter.hasNext();) {
+            QName propName = (QName) iter.next();
             PropertyId propId = new PropertyId(nodeState.getUUID(), propName);
-            props[i] = (PropertyState) stateMgr.getItemState(propId);
+            props[i++] = (PropertyState) stateMgr.getItemState(propId);
         }
         return props;
     }
@@ -483,9 +486,9 @@
 
         if (state.getStatus() != ItemState.STATUS_EXISTING) {
             // first store all transient properties
-            List props = state.getPropertyNames();
-            for (int i = 0; i < props.size(); i++) {
-                QName propName = (QName) props.get(i);
+            Set props = state.getPropertyNames();
+            for (Iterator iter = props.iterator(); iter.hasNext();) {
+                QName propName = (QName) iter.next();
                 PropertyState pstate = (PropertyState) stateMgr.getItemState(new PropertyId(state.getUUID(), propName));
                 if (pstate.getStatus() != ItemState.STATUS_EXISTING) {
                     stateMgr.store(pstate);
@@ -527,9 +530,9 @@
     private void reload(NodeState state) throws ItemStateException {
         if (state.getStatus() != ItemState.STATUS_EXISTING) {
             // first discard all all transient properties
-            List props = state.getPropertyNames();
-            for (int i = 0; i < props.size(); i++) {
-                QName propName = (QName) props.get(i);
+            Set props = state.getPropertyNames();
+            for (Iterator iter = props.iterator(); iter.hasNext();) {
+                QName propName = (QName) iter.next();
                 PropertyState pstate = (PropertyState) stateMgr.getItemState(new PropertyId(state.getUUID(), propName));
                 if (pstate.getStatus() != ItemState.STATUS_EXISTING) {
                     pstate.discard();