SOLR-996 had an incorrect fix.

git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@788291 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Noble Paul 2009-06-25 08:39:25 +00:00
parent c0543d2d71
commit a678924f96
3 changed files with 9 additions and 4 deletions

View File

@ -307,7 +307,6 @@ public class DocBuilder {
ContextImpl ctx = new ContextImpl(entity, vr, null,
pk == null ? Context.FULL_DUMP : Context.DELTA_DUMP,
session, parentCtx, this);
vr.context = ctx;
entityProcessor.init(ctx);
if (requestParameters.start > 0) {
@ -347,7 +346,6 @@ public class DocBuilder {
Map<String, Object> arow = entityProcessor.nextRow();
if (arow == null) {
entityProcessor.destroy();
break;
}
@ -425,6 +423,7 @@ public class DocBuilder {
if (verboseDebug) {
writer.log(SolrWriter.END_ENTITY, null, null);
}
entityProcessor.destroy();
}
}
@ -587,7 +586,6 @@ public class DocBuilder {
EntityProcessor entityProcessor = getEntityProcessor(entity);
ContextImpl context1 = new ContextImpl(entity, resolver, null, Context.FIND_DELTA, session, null, this);
resolver.context = context1;
entityProcessor.init(context1);
Set<Map<String, Object>> myModifiedPks = new HashSet<Map<String, Object>>();

View File

@ -49,6 +49,8 @@ public class EntityProcessorWrapper extends EntityProcessor {
protected List<Map<String, Object>> rowcache;
private Context contextCopy;
public EntityProcessorWrapper(EntityProcessor delegate, DocBuilder docBuilder) {
this.delegate = delegate;
this.docBuilder = docBuilder;
@ -58,6 +60,9 @@ public class EntityProcessorWrapper extends EntityProcessor {
rowcache = null;
this.context = context;
resolver = (VariableResolverImpl) context.getVariableResolver();
//context has to be set correctly . keep the copy of the old one so that it can be restored in destroy
contextCopy = resolver.context;
resolver.context = context;
if (entityName == null) {
onError = resolver.replaceTokens(context.getEntityAttribute(ON_ERROR));
if (onError == null) onError = ABORT;
@ -255,6 +260,8 @@ public class EntityProcessorWrapper extends EntityProcessor {
public void destroy() {
delegate.destroy();
resolver.context = contextCopy;
contextCopy = null;
}
@Override

View File

@ -37,7 +37,7 @@ public class VariableResolverImpl extends VariableResolver {
/**
* Used for creating Evaluators
*/
ContextImpl context;
Context context;
private final TemplateString templateString = new TemplateString();