avoid NullpointerException if close() method is called twice. See Bugzilla: #32403

Submitted by:	Wolf Siberski
Reviewed by:	Bernhard Messer


git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@150686 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Bernhard Messer 2004-11-29 20:41:01 +00:00
parent 2b6b9f83d3
commit adb32ee179
1 changed files with 4 additions and 2 deletions

View File

@ -338,8 +338,10 @@ public class IndexWriter {
public synchronized void close() throws IOException {
flushRamSegments();
ramDirectory.close();
writeLock.release(); // release write lock
writeLock = null;
if (writeLock != null) {
writeLock.release(); // release write lock
writeLock = null;
}
if(closeDir)
directory.close();
}