cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject svn commit: r653074 - /cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/ToOneFault.java
Date Sat, 03 May 2008 13:07:23 GMT
Author: aadamchik
Date: Sat May  3 06:07:22 2008
New Revision: 653074

URL: http://svn.apache.org/viewvc?rev=653074&view=rev
Log:
CAY-1045 postRemove lifecycle callback not NPE safe
(validating the arguments)

Modified:
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/ToOneFault.java

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/ToOneFault.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/ToOneFault.java?rev=653074&r1=653073&r2=653074&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/ToOneFault.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/ToOneFault.java
Sat May  3 06:07:22 2008
@@ -38,6 +38,15 @@
      */
     @Override
     public Object resolveFault(Persistent sourceObject, String relationshipName) {
+
+        if (sourceObject.getObjectContext() == null) {
+            throw new IllegalStateException(
+                    "Null ObjectContext. Can't read a to-one relationshup '"
+                            + relationshipName
+                            + "' for an object with ID: "
+                            + sourceObject.getObjectId());
+        }
+
         int state = sourceObject.getPersistenceState();
         if (state == PersistenceState.NEW) {
             return null;



Mime
View raw message