cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject svn commit: r655530 - in /cayenne/main/trunk: docs/doc/src/main/resources/ framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/ framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/
Date Mon, 12 May 2008 15:32:20 GMT
Author: aadamchik
Date: Mon May 12 08:32:20 2008
New Revision: 655530

URL: http://svn.apache.org/viewvc?rev=655530&view=rev
Log:
CAY-1054 Error removing object from a paginated list after the object was deleted and the
context committed

Modified:
    cayenne/main/trunk/docs/doc/src/main/resources/RELEASE-NOTES.txt
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/IncrementalFaultList.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/SimpleIdIncrementalFaultListTest.java

Modified: cayenne/main/trunk/docs/doc/src/main/resources/RELEASE-NOTES.txt
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/docs/doc/src/main/resources/RELEASE-NOTES.txt?rev=655530&r1=655529&r2=655530&view=diff
==============================================================================
--- cayenne/main/trunk/docs/doc/src/main/resources/RELEASE-NOTES.txt (original)
+++ cayenne/main/trunk/docs/doc/src/main/resources/RELEASE-NOTES.txt Mon May 12 08:32:20 2008
@@ -64,6 +64,7 @@
 CAY-1043 NPE in ConnectionWrapper on rollback
 CAY-1044 NPE on commit when the new object was deleted before commit
 CAY-1053 MapQueryCache.CacheEntry not serializable
+CAY-1054 Error removing object from a paginated list after the object was deleted and the
context committed
 
 ----------------------------------
 Release: 3.0M3

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/IncrementalFaultList.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/IncrementalFaultList.java?rev=655530&r1=655529&r2=655530&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/IncrementalFaultList.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/IncrementalFaultList.java
Mon May 12 08:32:20 2008
@@ -775,12 +775,14 @@
                 return true;
             }
 
-            Persistent dataObj = (Persistent) object;
-            if (dataObj.getObjectContext() != dataContext) {
+            Persistent persistent = (Persistent) object;
+            // NULL ObjectContext can be a result of a delete/commit operation
+            if (persistent.getObjectContext() != null
+                    && persistent.getObjectContext() != dataContext) {
                 return true;
             }
 
-            if (!dataObj.getObjectId().getEntityName().equals(rootEntity.getName())) {
+            if (!persistent.getObjectId().getEntityName().equals(rootEntity.getName())) {
                 return true;
             }
 

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/SimpleIdIncrementalFaultListTest.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/SimpleIdIncrementalFaultListTest.java?rev=655530&r1=655529&r2=655530&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/SimpleIdIncrementalFaultListTest.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/SimpleIdIncrementalFaultListTest.java
Mon May 12 08:32:20 2008
@@ -22,7 +22,6 @@
 import java.util.Iterator;
 import java.util.List;
 import java.util.ListIterator;
-import java.util.Map;
 
 import org.apache.art.Artist;
 import org.apache.cayenne.DataObject;
@@ -41,6 +40,33 @@
     protected SimpleIdIncrementalFaultList<?> list;
     protected Query query;
 
+    @Override
+    protected void setUp() throws Exception {
+        super.setUp();
+        deleteTestData();
+    }
+
+    public void testRemoveDeleted() throws Exception {
+        createTestData("testArtists");
+
+        DataContext context = createDataContext();
+
+        SelectQuery query = new SelectQuery(Artist.class);
+        query.setPageSize(10);
+        SimpleIdIncrementalFaultList<Artist> list = new SimpleIdIncrementalFaultList<Artist>(
+                context,
+                query);
+
+        assertEquals(25, list.size());
+
+        Artist a1 = list.get(0);
+        context.deleteObject(a1);
+        context.commitChanges();
+
+        list.remove(0);
+        assertEquals(24, list.size());
+    }
+
     protected void prepareList(int pageSize) throws Exception {
         super.setUp();
         deleteTestData();



Mime
View raw message