Revision: 14607
          http://gate.svn.sourceforge.net/gate/?rev=14607&view=rev
Author:   valyt
Date:     2011-11-25 11:07:25 +0000 (Fri, 25 Nov 2011)
Log Message:
-----------
Bugfix: when shortcutting the creation of the underlying executor we need to 
protect against NPEs.

Modified Paths:
--------------
    
mimir/branches/3.4/mimir-core/src/gate/mimir/search/query/AnnotationQuery.java

Modified: 
mimir/branches/3.4/mimir-core/src/gate/mimir/search/query/AnnotationQuery.java
===================================================================
--- 
mimir/branches/3.4/mimir-core/src/gate/mimir/search/query/AnnotationQuery.java  
    2011-11-25 10:33:59 UTC (rev 14606)
+++ 
mimir/branches/3.4/mimir-core/src/gate/mimir/search/query/AnnotationQuery.java  
    2011-11-25 11:07:25 UTC (rev 14607)
@@ -24,6 +24,7 @@
 import gate.mimir.search.QueryEngine;
 import it.unimi.dsi.fastutil.ints.IntList;
 import it.unimi.dsi.fastutil.objects.ReferenceSet;
+import it.unimi.dsi.fastutil.objects.ReferenceSets;
 import it.unimi.dsi.mg4j.index.Index;
 import it.unimi.dsi.mg4j.search.visitor.DocumentIteratorVisitor;
 
@@ -141,6 +142,7 @@
      * @see gate.mimir.search.query.QueryExecutor#getLatestDocument()
      */
     public int getLatestDocument() {
+      if(closed || latestDocument == -1) return -1;
       return underlyingExecutor.getLatestDocument();
     }
 
@@ -174,10 +176,15 @@
    
     @Override
     public ReferenceSet<Index> indices() {
-      return underlyingExecutor.indices();
+      if(underlyingExecutor != null) {
+        return underlyingExecutor.indices();
+      } else {
+        return ReferenceSets.EMPTY_SET;
+      }
     }
     
     public <T> T accept( final DocumentIteratorVisitor<T> visitor ) throws 
IOException {
+      if(underlyingExecutor == null) return null;
       if ( ! visitor.visitPre( this ) ) return null;
       final T[] a = visitor.newArray( 1 );
       if ( a == null ) {
@@ -190,6 +197,7 @@
     }
 
     public <T> T acceptOnTruePaths( final DocumentIteratorVisitor<T> visitor ) 
throws IOException {
+      if(underlyingExecutor == null) return null;
       if ( ! visitor.visitPre( this ) ) return null;
       final T[] a = visitor.newArray( 1 );
       if ( a == null ) {

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure 
contains a definitive record of customers, application performance, 
security threats, fraudulent activity, and more. Splunk takes this 
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d
_______________________________________________
GATE-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gate-cvs

Reply via email to