Add clonning of values in fact logging to keep initial values - debug

This commit is contained in:
Nicolas Héron 2020-07-28 14:36:35 +02:00
commit 760ae20f49
35 changed files with 82 additions and 43 deletions

View file

@ -16,6 +16,7 @@
package org.chtijbug.drools.runtime.impl;
import com.rits.cloning.Cloner;
import com.rits.cloning.ObjenesisInstantiationStrategy;
import com.thoughtworks.xstream.XStream;
import com.thoughtworks.xstream.io.json.JettisonMappedXmlDriver;
import org.chtijbug.drools.common.reflection.ReflectionUtils;
@ -384,8 +385,13 @@ public class RuleBaseStatefulSession implements RuleBaseSession {
Object inputObjectClone;
if (inputObject != null) {
this.insertByReflection(inputObject);
Cloner cloner = new Cloner();
inputObject.getClass().getClassLoader();
Thread currentThread = Thread.currentThread();
ClassLoader old = currentThread.getContextClassLoader();
currentThread.setContextClassLoader(inputObject.getClass().getClassLoader());
Cloner cloner = new Cloner(new ObjenesisInstantiationStrategy());
inputObjectClone=cloner.deepClone(inputObject);
currentThread.setContextClassLoader(old);
inputDroolsObject = DroolsFactObjectFactory.createFactObject(inputObjectClone);
}
if (processName != null && processName.length() > 0) {