From 3eb663ea10c259f9534a761cf2d0a8959ce1c7ec Mon Sep 17 00:00:00 2001 From: Noble Paul Date: Tue, 9 Feb 2010 05:20:19 +0000 Subject: [PATCH] SOLR-1757: DIH multithreading sometimes throws NPE. git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@907935 13f79535-47bb-0310-9956-ffa450edef68 --- contrib/dataimporthandler/CHANGES.txt | 2 ++ .../java/org/apache/solr/handler/dataimport/DocBuilder.java | 6 +++--- .../org/apache/solr/handler/dataimport/JdbcDataSource.java | 2 -- .../handler/dataimport/ThreadedEntityProcessorWrapper.java | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/contrib/dataimporthandler/CHANGES.txt b/contrib/dataimporthandler/CHANGES.txt index 82b294d4f64..709dba9392b 100644 --- a/contrib/dataimporthandler/CHANGES.txt +++ b/contrib/dataimporthandler/CHANGES.txt @@ -57,6 +57,8 @@ Bug Fixes * SOLR-1762: DateFormatTransformer does not work correctly with non-default locale dates (tommy chheng via noble) +* SOLR-1757: DIH multithreading sometimes throws NPE (noble) + Other Changes ---------------------- diff --git a/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/DocBuilder.java b/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/DocBuilder.java index 543b93620bb..42423a21e78 100644 --- a/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/DocBuilder.java +++ b/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/DocBuilder.java @@ -345,11 +345,11 @@ public class DocBuilder { private DocWrapper docWrapper; private volatile boolean entityInitialized ; String currentProcess; - ThreadLocal currentEntityProcWrapper = new ThreadLocal(); + final ThreadLocal currentEntityProcWrapper = new ThreadLocal(); private ContextImpl context; - EntityRunner parent; - AtomicBoolean entityEnded = new AtomicBoolean(false); + final EntityRunner parent; + final AtomicBoolean entityEnded = new AtomicBoolean(false); private Exception exception; public EntityRunner(DataConfig.Entity entity, EntityRunner parent) { diff --git a/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/JdbcDataSource.java b/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/JdbcDataSource.java index 6398cf6e870..cb38e480bf0 100644 --- a/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/JdbcDataSource.java +++ b/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/JdbcDataSource.java @@ -126,8 +126,6 @@ public class JdbcDataSource extends return factory = new Callable() { public Connection call() throws Exception { - // Resolve variables again because the variables may have changed - resolveVariables(context, initProps); LOG.info("Creating a connection for entity " + context.getEntityAttribute(DataImporter.NAME) + " with URL: " + url); diff --git a/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/ThreadedEntityProcessorWrapper.java b/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/ThreadedEntityProcessorWrapper.java index 8cb857e1543..692be738163 100644 --- a/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/ThreadedEntityProcessorWrapper.java +++ b/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/ThreadedEntityProcessorWrapper.java @@ -36,10 +36,10 @@ import java.util.Collections; public class ThreadedEntityProcessorWrapper extends EntityProcessorWrapper { private static final Logger LOG = LoggerFactory.getLogger(ThreadedEntityProcessorWrapper.class); - DocBuilder.EntityRunner entityRunner; + final DocBuilder.EntityRunner entityRunner; /**For each child entity there is one EntityRunner */ - Map children; + final Map children; public ThreadedEntityProcessorWrapper(EntityProcessor delegate, DocBuilder docBuilder, DocBuilder.EntityRunner entityRunner,