[jsword-devel] [JIRA] Updated: (JS-111) BookIndexer does not wait for indexing to complete

DM Smith (JIRA) jira at crosswire.org
Sun Feb 6 15:09:55 MST 2011


     [ http://www.crosswire.org/bugs/browse/JS-111?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

DM Smith updated JS-111:
------------------------

    Fix Version/s: 1.6.1

> BookIndexer does not wait for indexing to complete
> --------------------------------------------------
>
>                 Key: JS-111
>                 URL: http://www.crosswire.org/bugs/browse/JS-111
>             Project: JSword
>          Issue Type: Bug
>         Environment: Windows, jdk 6
>            Reporter: Martin Denham
>            Assignee: DM Smith
>            Priority: Minor
>             Fix For: 1.6.1
>
>
> 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;
>  
> @@ -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;

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira



More information about the jsword-devel mailing list