mirror of https://github.com/apache/lucene.git
LUCENE--4595: EnwikiContentSource thread safety NPE in 'forever' mode
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1418281 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
49593470e3
commit
f96b02af06
|
@ -219,6 +219,9 @@ Bug Fixes
|
|||
In addition, it wasn't possible to index a shape representing the entire
|
||||
globe.
|
||||
|
||||
* LUCENE--4595: EnwikiContentSource had a thread safety problem (NPE) in
|
||||
'forever' mode (Doron Cohen)
|
||||
|
||||
Optimizations
|
||||
|
||||
* LUCENE-2221: oal.util.BitUtil was modified to use Long.bitCount and
|
||||
|
|
|
@ -178,6 +178,7 @@ public class EnwikiContentSource extends ContentSource {
|
|||
reader.setErrorHandler(this);
|
||||
while(!stopped){
|
||||
final InputStream localFileIS = is;
|
||||
if (localFileIS != null) { // null means fileIS was closed on us
|
||||
try {
|
||||
// To work around a bug in XERCES (XERCESJ-1257), we assume the XML is always UTF8, so we simply provide reader.
|
||||
CharsetDecoder decoder = IOUtils.CHARSET_UTF_8.newDecoder()
|
||||
|
@ -193,8 +194,9 @@ public class EnwikiContentSource extends ContentSource {
|
|||
throw ioe;
|
||||
}
|
||||
}
|
||||
}
|
||||
synchronized(this) {
|
||||
if (!forever) {
|
||||
if (stopped || !forever) {
|
||||
nmde = new NoMoreDataException();
|
||||
notify();
|
||||
return;
|
||||
|
@ -291,11 +293,11 @@ public class EnwikiContentSource extends ContentSource {
|
|||
@Override
|
||||
public void close() throws IOException {
|
||||
synchronized (EnwikiContentSource.this) {
|
||||
parser.stop();
|
||||
if (is != null) {
|
||||
is.close();
|
||||
is = null;
|
||||
}
|
||||
parser.stop();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue