Details
-
Type: Bug
-
Status: Closed (View Workflow)
-
Priority: Minor
-
Resolution: Fixed
-
Affects Version/s: None
-
Fix Version/s: 1.6.1
-
Component/s: o.c.jsword.index
-
Labels:None
-
Environment:
Windows, jdk 6
Description
After BookIndexer.createIndex calls
book.addIndexStatusListener(isl)
it next does
indexManager.scheduleIndexCreation(book);
which calls
book.setIndexStatus(IndexStatus.SCHEDULED);
which triggers the isl but the index has just started being created and is not yet finished. So the isl should check the new index status before setting done=true.
Here is a possible patch:
-
-
- Eclipse Workspace Patch 1.0
#P jsword
Index: src/main/java/org/crosswire/jsword/bridge/BookIndexer.java
===================================================================
- src/main/java/org/crosswire/jsword/bridge/BookIndexer.java (revision 1999)
+++ src/main/java/org/crosswire/jsword/bridge/BookIndexer.java (working copy)
@@ -26,6 +26,7 @@
import org.crosswire.jsword.book.Books;
import org.crosswire.jsword.index.IndexManager;
import org.crosswire.jsword.index.IndexManagerFactory;
+import org.crosswire.jsword.index.IndexStatus;
import org.crosswire.jsword.index.IndexStatusEvent;
import org.crosswire.jsword.index.IndexStatusListener;
- Eclipse Workspace Patch 1.0
-
@@ -106,7 +107,13 @@
}
public void statusChanged(IndexStatusEvent ev) {
- indexer.setDone(true);
+ IndexStatus newStatus = ev.getIndexStatus();
+ if (newStatus.equals(IndexStatus.DONE) ||
+ newStatus.equals(IndexStatus.UNDONE) ||
+ newStatus.equals(IndexStatus.INVALID)) { + indexer.setDone(true); + }}
private BookIndexer indexer;