openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From p..@apache.org
Subject svn commit: r633739 - in /openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/datacache: DataCachePCDataImpl.java QueryCacheStoreQuery.java
Date Wed, 05 Mar 2008 01:21:59 GMT
Author: pcl
Date: Tue Mar  4 17:21:58 2008
New Revision: 633739

URL: http://svn.apache.org/viewvc?rev=633739&view=rev
Log:
Fix NPE reported on newsgroup.

Modified:
    openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/datacache/DataCachePCDataImpl.java
    openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/datacache/QueryCacheStoreQuery.java

Modified: openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/datacache/DataCachePCDataImpl.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/datacache/DataCachePCDataImpl.java?rev=633739&r1=633738&r2=633739&view=diff
==============================================================================
--- openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/datacache/DataCachePCDataImpl.java
(original)
+++ openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/datacache/DataCachePCDataImpl.java
Tue Mar  4 17:21:58 2008
@@ -168,7 +168,8 @@
                     .indexOf(fmd.getName()) != -1) {
                     DataCache cache = sm.getMetaData().getDataCache();
                     Object oid = sm.getContext().getObjectId(sm.fetch(i));
-                    DataCachePCData data = cache.get(oid);
+                    DataCachePCData data = cache == null ? null
+                        : cache.get(oid);
                     if ((data != null) &&
                         (data instanceof DataCachePCDataImpl)) {
                         ((DataCachePCDataImpl) data)

Modified: openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/datacache/QueryCacheStoreQuery.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/datacache/QueryCacheStoreQuery.java?rev=633739&r1=633738&r2=633739&view=diff
==============================================================================
--- openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/datacache/QueryCacheStoreQuery.java
(original)
+++ openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/datacache/QueryCacheStoreQuery.java
Tue Mar  4 17:21:58 2008
@@ -128,6 +128,9 @@
             // using it because of the individual by-oid lookups
             ClassMetaData meta = _repos.getMetaData(getContext().
                 getCandidateType(), _sctx.getClassLoader(), true);
+            if (meta.getDataCache() == null)
+                return null;
+
             BitSet idxs = meta.getDataCache().containsAll(res);
 
             // eventually we should optimize this to figure out how many objects
@@ -333,9 +336,11 @@
                 (q.getContext(), classes));
 
             // evict from the data cache
-            for (int i = 0; i < cmd.length; i++)
-                cmd[i].getDataCache().removeAll(
-                    cmd[i].getDescribedType(), true);
+            for (int i = 0; i < cmd.length; i++) {
+                if (cmd[i].getDataCache() != null)
+                    cmd[i].getDataCache().removeAll(
+                        cmd[i].getDescribedType(), true);
+            }
         }
 
         public Number executeDelete(StoreQuery q, Object[] params) {



Mime
View raw message