Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

PersisterHelper and MarshallerReaderContext Supporting a different class loader #120

Merged
merged 2 commits into from

1 participant

@Salaboy
Owner
  • adding field classloader to MarshallerReaderContext
  • Checking for different classloaders in PersisterHelper
@Salaboy Salaboy merged commit 182072f into from
@mrietveld mrietveld deleted the branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on May 22, 2012
  1. @Salaboy

    - adding field classloader to MarshallerReaderContext

    Salaboy authored
    - Checking for different classloaders in PersisterHelper
  2. @Salaboy
This page is out of date. Refresh to see the latest.
View
8 drools-core/src/main/java/org/drools/marshalling/impl/MarshallerReaderContext.java
@@ -70,6 +70,7 @@
public final Map<Integer, Object> nodeMemories;
public Object parameterObject;
+ public ClassLoader classLoader;
public MarshallerReaderContext(InputStream stream,
InternalRuleBase ruleBase,
@@ -135,7 +136,12 @@ public MarshallerReaderContext(InputStream stream,
ClassNotFoundException {
String name = desc.getName();
try {
- return Class.forName( name, false, (this.ruleBase == null) ? null : this.ruleBase.getRootClassLoader() );
+ if(this.classLoader == null){
+ if(this.ruleBase != null){
+ this.classLoader = this.ruleBase.getRootClassLoader();
+ }
+ }
+ return Class.forName( name, false, this.classLoader );
} catch ( ClassNotFoundException ex ) {
return super.resolveClass( desc );
}
View
8 drools-core/src/main/java/org/drools/marshalling/impl/PersisterHelper.java
@@ -255,7 +255,13 @@ private static void loadStrategiesIndex(MarshallerReaderContext context,
Context ctx = strategyObject.createContext();
context.strategyContexts.put( strategyObject, ctx );
if( _entry.hasData() && ctx != null ) {
- ctx.read( new DroolsObjectInputStream( _entry.getData().newInput(), context.ruleBase.getRootClassLoader() ) );
+ ClassLoader classLoader = null;
+ if (context.classLoader != null ){
+ classLoader = context.classLoader;
+ } else if(context.ruleBase != null){
+ classLoader = context.ruleBase.getRootClassLoader();
+ }
+ ctx.read( new DroolsObjectInputStream( _entry.getData().newInput(), classLoader) );
}
}
}
Something went wrong with that request. Please try again.