Revision: 14608
http://gate.svn.sourceforge.net/gate/?rev=14608&view=rev
Author: valyt
Date: 2011-11-25 11:11:56 +0000 (Fri, 25 Nov 2011)
Log Message:
-----------
Some NPE guards brought over from the 3.4 branch.
Modified Paths:
--------------
mimir/trunk/mimir-core/src/gate/mimir/search/query/AnnotationQuery.java
Modified:
mimir/trunk/mimir-core/src/gate/mimir/search/query/AnnotationQuery.java
===================================================================
--- mimir/trunk/mimir-core/src/gate/mimir/search/query/AnnotationQuery.java
2011-11-25 11:07:25 UTC (rev 14607)
+++ mimir/trunk/mimir-core/src/gate/mimir/search/query/AnnotationQuery.java
2011-11-25 11:11:56 UTC (rev 14608)
@@ -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;
@@ -100,12 +101,11 @@
}
QueryNode underlyingQuery = new OrQuery(disjuncts);
- underlyingExecutor = underlyingQuery.getQueryExecutor(engine);
+ underlyingExecutor = underlyingQuery.getQueryExecutor(engine);
} else {
// no results from the helper => no results from us
latestDocument = -1;
}
-
}
/**
@@ -142,6 +142,7 @@
* @see gate.mimir.search.query.QueryExecutor#getLatestDocument()
*/
public int getLatestDocument() {
+ if(closed || latestDocument == -1) return -1;
return underlyingExecutor.getLatestDocument();
}
@@ -175,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 ) {
@@ -191,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