[jboss-svn-commits] JBL Code SVN: r7098 - labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Wed Oct 25 05:10:59 EDT 2006


Author: mark.proctor at jboss.com
Date: 2006-10-25 05:10:57 -0400 (Wed, 25 Oct 2006)
New Revision: 7098

Modified:
   labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/AbstractWorkingMemory.java
Log:
-Fixed testLogicalAssertionsWithExists, did this my doing the retractObject before we update the handle with the potentially  new  object

Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/AbstractWorkingMemory.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/AbstractWorkingMemory.java	2006-10-25 09:10:51 UTC (rev 7097)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/AbstractWorkingMemory.java	2006-10-25 09:10:57 UTC (rev 7098)
@@ -826,7 +826,7 @@
             this.lock.lock();
             final int status = ((InternalFactHandle) factHandle).getEqualityKey().getStatus();
             final InternalFactHandle handle = (InternalFactHandle) factHandle;
-            final Object originalObject = handle.getObject();
+            final Object originalObject = ( handle.isShadowFact() ) ? ((ShadowProxy)handle.getObject()).getShadowedObject() : handle.getObject();
 
             if ( handle.getId() == -1 || object == null ) {
                 // the handle is invalid, most likely already  retracted, so return
@@ -834,6 +834,14 @@
                 return;
             }
 
+            // Nowretract any trace  of the original fact
+            final PropagationContext propagationContext = new PropagationContextImpl( this.propagationIdCounter++,
+                                                                                      PropagationContext.MODIFICATION,
+                                                                                      rule,
+                                                                                      activation );
+            doRetract( handle,
+                       propagationContext );            
+            
             // set anyway, so that it updates the hashCodes
             handle.setObject( object );
 
@@ -864,13 +872,6 @@
 
             handle.setEqualityKey( key );
 
-            final PropagationContext propagationContext = new PropagationContextImpl( this.propagationIdCounter++,
-                                                                                      PropagationContext.MODIFICATION,
-                                                                                      rule,
-                                                                                      activation );
-            doRetract( handle,
-                       propagationContext );
-
             this.handleFactory.increaseFactHandleRecency( handle );
 
             doAssertObject( handle,




More information about the jboss-svn-commits mailing list