From 4e0b942d914dd94f2a1f875b7048d0a381af97df Mon Sep 17 00:00:00 2001 From: bdc34 Date: Tue, 1 Feb 2011 21:21:19 +0000 Subject: [PATCH] Adding exception checking to IndividualListController.java NIHVIVO-1687 --- .../webapp/controller/EntityListController.java | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/EntityListController.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/EntityListController.java index e3eaddd22..8d4b043e5 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/EntityListController.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/EntityListController.java @@ -181,15 +181,19 @@ public class EntityListController extends VitroHttpServlet { //execute lucene query for individuals of the specified type IndexSearcher index = LuceneIndexFactory.getIndexSearcher(context); - TopDocs docs = index.search(query, null, + TopDocs docs = null; + try{ + docs = index.search(query, null, ENTITY_LIST_CONTROLLER_MAX_RESULTS, - new Sort(Entity2LuceneDoc.term.NAMEUNANALYZED)); - - if( docs == null ){ - log.error("Search of lucene index returned null"); - throw new ServletException("Search of lucene index returned null"); + new Sort(Entity2LuceneDoc.term.NAMEUNANALYZED)); + }catch(Throwable th){ + log.error("Could not run search. " + th.getMessage()); + docs = null; } + if( docs == null ) + throw new ServletException("Could not run search in EntityListController"); + //get list of individuals for the search results int size = docs.totalHits; // don't get all the results, only get results for the requestedSize