cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject svn commit: r565900 - in /cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne: access/DataDomainQueryAction.java map/AshwoodEntitySorter.java
Date Tue, 14 Aug 2007 20:37:29 GMT
Author: aadamchik
Date: Tue Aug 14 13:37:28 2007
New Revision: 565900

URL: http://svn.apache.org/viewvc?view=rev&rev=565900
Log:
DataDomainQueryAction NPE fix

Modified:
    cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/access/DataDomainQueryAction.java
    cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/map/AshwoodEntitySorter.java

Modified: cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/access/DataDomainQueryAction.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/access/DataDomainQueryAction.java?view=diff&rev=565900&r1=565899&r2=565900
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/access/DataDomainQueryAction.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/access/DataDomainQueryAction.java
Tue Aug 14 13:37:28 2007
@@ -168,10 +168,10 @@
         if (query instanceof ObjectIdQuery) {
 
             ObjectIdQuery oidQuery = (ObjectIdQuery) query;
-
             DataRow row = null;
 
-            if (!oidQuery.isFetchMandatory()) {
+            if (cache != null
+                    && !oidQuery.isFetchMandatory()) {
                 row = cache.getCachedSnapshot(oidQuery.getObjectId());
             }
 
@@ -214,8 +214,11 @@
                 return !DONE;
             }
 
+            if(cache == null) {
+                return !DONE;
+            }
+            
             DataRow sourceRow = cache.getCachedSnapshot(relationshipQuery.getObjectId());
-
             if (sourceRow == null) {
                 return !DONE;
             }

Modified: cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/map/AshwoodEntitySorter.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/map/AshwoodEntitySorter.java?view=diff&rev=565900&r1=565899&r2=565900
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/map/AshwoodEntitySorter.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/map/AshwoodEntitySorter.java
Tue Aug 14 13:37:28 2007
@@ -302,16 +302,22 @@
 
         // find committed snapshot - so we can't fetch from the context as it will return
         // dirty snapshot; must go down the stack instead
+
+        // how do we handle this for NEW objects correctly? For now bail from the method
+        if (object.getObjectId().isTemporary()) {
+            return null;
+        }
+
         ObjectIdQuery query = new ObjectIdQuery(
                 object.getObjectId(),
                 true,
                 ObjectIdQuery.CACHE);
         QueryResponse response = context.getChannel().onQuery(null, query);
         List result = response.firstList();
-        if(result == null || result.size() == 0) {
+        if (result == null || result.size() == 0) {
             return null;
         }
-        
+
         DataRow snapshot = (DataRow) result.get(0);
 
         ObjectId id = snapshot.createTargetObjectId(targetEntityName, finalRel);



Mime
View raw message