portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tay...@apache.org
Subject svn commit: r391144 - /portals/jetspeed-2/trunk/components/search/src/java/org/apache/jetspeed/search/lucene/SearchEngineImpl.java
Date Mon, 03 Apr 2006 20:35:14 GMT
Author: taylor
Date: Mon Apr  3 13:35:12 2006
New Revision: 391144

URL: http://svn.apache.org/viewcvs?rev=391144&view=rev
Log:
better error handling

Modified:
    portals/jetspeed-2/trunk/components/search/src/java/org/apache/jetspeed/search/lucene/SearchEngineImpl.java

Modified: portals/jetspeed-2/trunk/components/search/src/java/org/apache/jetspeed/search/lucene/SearchEngineImpl.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/search/src/java/org/apache/jetspeed/search/lucene/SearchEngineImpl.java?rev=391144&r1=391143&r2=391144&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/search/src/java/org/apache/jetspeed/search/lucene/SearchEngineImpl.java
(original)
+++ portals/jetspeed-2/trunk/components/search/src/java/org/apache/jetspeed/search/lucene/SearchEngineImpl.java
Mon Apr  3 13:35:12 2006
@@ -27,6 +27,8 @@
 
 import org.apache.commons.collections.MultiHashMap;
 import org.apache.commons.collections.MultiMap;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 import org.apache.jetspeed.search.BaseParsedObject;
 import org.apache.jetspeed.search.HandlerFactory;
 import org.apache.jetspeed.search.ObjectHandler;
@@ -53,6 +55,7 @@
  */
 public class SearchEngineImpl implements SearchEngine
 {
+    protected final static Log log = LogFactory.getLog(SearchEngineImpl.class);
     private File rootIndexDir = null;
     private String analyzerClassName = null;
     private boolean optimizeAfterUpdate = true;
@@ -62,6 +65,7 @@
     private static final int TEXT = 1;
     
     public SearchEngineImpl(String indexRoot, String analyzerClassName, boolean optimzeAfterUpdate,
HandlerFactory handlerFactory)
+    throws Exception
     {
         //assume it's full path for now
         rootIndexDir = new File(indexRoot);
@@ -82,17 +86,22 @@
         }
         catch (Exception e)
         {
+            log.error("Failed to create Portal Registry indexes in "  + rootIndexDir.getPath(),
e);
             try
             {
+                rootIndexDir.delete();
+                rootIndexDir.mkdirs();
+                
                 IndexWriter indexWriter = new IndexWriter(rootIndexDir, newAnalyzer(), true);
                 indexWriter.close();
                 indexWriter = null;
-                //logger.info("Created Lucene Index in " + rootIndexDir.getPath());
+                log.warn("Re-created Lucene Index in " + rootIndexDir.getPath());
             }
             catch (Exception e1)
             {
-                //logger.error(this.getClass().getName() + ".initConfiguration - Getting
or creating IndexSearcher", e);
-                //throw new InitializationException("Getting or creating Index Searcher");
+                String message = "Cannot RECREATE Portlet Registry indexes in "  + rootIndexDir.getPath();
+                log.error(message, e);
+                throw new Exception(message);
             }
         }
     }



---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org


Mime
View raw message