for (int i = 0; i < nbVariables; i++) {
String name = stream.readUTF();
try {
int index = stream.readInt();
ObjectMarshallingStrategy strategy = null;
// Old way of retrieving strategy objects
if (index >= 0) {
strategy = context.resolverStrategyFactory.getStrategy( index );
if (strategy == null) {
throw new IllegalStateException( "No strategy of with index " + index + " available." );
}
}
// New way
else if (index == -2) {
String strategyClassName = stream.readUTF();
// fix for backwards compatibility (5.x -> 6.x)
if ("org.drools.marshalling.impl.SerializablePlaceholderResolverStrategy".equals(strategyClassName)) {
strategyClassName = "org.drools.core.marshalling.impl.SerializablePlaceholderResolverStrategy";
}
strategy = context.resolverStrategyFactory.getStrategyObject( strategyClassName );
if (strategy == null) {
throw new IllegalStateException( "No strategy of type " + strategyClassName + " available." );
}
}
Object value = strategy.read( stream );
workItem.setParameter( name,
value );
} catch (ClassNotFoundException e) {
throw new IllegalArgumentException(
"Could not reload variable " + name );