Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2011-09-23 10:18:46 +0000
committerEike Stepper2011-09-23 10:18:46 +0000
commit245c51b22f6108a3d0345f78aa08e3cd285102c7 (patch)
treef7706bdacc1886a0daa538099274cc30f5e4f4b4
parentabf0f98620a1836877838c61cdfe858d7c9d2be1 (diff)
downloadcdo-245c51b22f6108a3d0345f78aa08e3cd285102c7.tar.gz
cdo-245c51b22f6108a3d0345f78aa08e3cd285102c7.tar.xz
cdo-245c51b22f6108a3d0345f78aa08e3cd285102c7.zip
[358581] AbstractCDOView.getObjectsArray gives array with NULLs
https://bugs.eclipse.org/bugs/show_bug.cgi?id=358581
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/view/AbstractCDOView.java16
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/view/CDOViewImpl.java18
2 files changed, 15 insertions, 19 deletions
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/view/AbstractCDOView.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/view/AbstractCDOView.java
index 4a29f5c214..53a6948aed 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/view/AbstractCDOView.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/view/AbstractCDOView.java
@@ -90,7 +90,6 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
-import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -473,19 +472,18 @@ public abstract class AbstractCDOView extends Lifecycle implements InternalCDOVi
return revision;
}
- public synchronized InternalCDOObject[] getObjectsArray()
+ public synchronized List<InternalCDOObject> getObjectsList()
{
- Collection<InternalCDOObject> values = objects.values();
- List<InternalCDOObject> valuesNoNull = new ArrayList<InternalCDOObject>(values.size());
- for (Iterator<InternalCDOObject> it = values.iterator(); it.hasNext();)
+ List<InternalCDOObject> result = new ArrayList<InternalCDOObject>();
+ for (InternalCDOObject value : objects.values())
{
- InternalCDOObject next = it.next();
- if (next != null)
+ if (value != null)
{
- valuesNoNull.add(next);
+ result.add(value);
}
}
- return valuesNoNull.toArray(new InternalCDOObject[valuesNoNull.size()]);
+
+ return result;
}
public synchronized CDOResource getResource(String path)
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/view/CDOViewImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/view/CDOViewImpl.java
index 574f745b63..9fd99237e3 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/view/CDOViewImpl.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/view/CDOViewImpl.java
@@ -1141,20 +1141,18 @@ public class CDOViewImpl extends AbstractCDOView
private void reset()
{
- // Keep the object in memory
- Set<CDOObject> oldObject = objects;
+ // Keep the objects in memory
+ Set<CDOObject> oldObjects = objects;
objects = new HashBag<CDOObject>();
if (options().getStrongReferencePolicy() != CDOAdapterPolicy.NONE)
{
- InternalCDOObject objects[] = getObjectsArray();
- for (int i = 0; i < objects.length; i++)
+ for (InternalCDOObject object : getObjectsList())
{
- InternalCDOObject object = objects[i];
attachObject(object);
}
}
- oldObject.clear();
+ oldObjects.clear();
}
}
@@ -1196,13 +1194,13 @@ public class CDOViewImpl extends AbstractCDOView
List<CDOID> ids = new ArrayList<CDOID>();
if (policiesPresent)
{
- for (InternalCDOObject cdoObject : getObjectsArray())
+ for (InternalCDOObject object : getObjectsList())
{
- int count = getNumberOfValidAdapter(cdoObject);
+ int count = getNumberOfValidAdapter(object);
if (count > 0)
{
- ids.add(cdoObject.cdoID());
- addEntry(cdoObject.cdoID(), cdoObject, count);
+ ids.add(object.cdoID());
+ addEntry(object.cdoID(), object, count);
}
}
}

Back to the top