lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hoss...@apache.org
Subject svn commit: r1098764 - in /lucene/dev/branches/branch_3x/solr: ./ CHANGES.txt src/java/org/apache/solr/schema/IndexSchema.java
Date Mon, 02 May 2011 19:47:21 GMT
Author: hossman
Date: Mon May  2 19:47:21 2011
New Revision: 1098764

URL: http://svn.apache.org/viewvc?rev=1098764&view=rev
Log:
SOLR-2467: merge 1098760 from trunk

Modified:
    lucene/dev/branches/branch_3x/solr/   (props changed)
    lucene/dev/branches/branch_3x/solr/CHANGES.txt
    lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/schema/IndexSchema.java

Modified: lucene/dev/branches/branch_3x/solr/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/solr/CHANGES.txt?rev=1098764&r1=1098763&r2=1098764&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/solr/CHANGES.txt (original)
+++ lucene/dev/branches/branch_3x/solr/CHANGES.txt Mon May  2 19:47:21 2011
@@ -87,6 +87,10 @@ Bug Fixes
   did not clear all attributes so they displayed incorrect attribute values for tokens
   in later filter stages. (uschindler, rmuir, yonik)
 
+* SOLR-2467: Fix <analyzer class="..." /> initialization so any errors 
+  are logged properly.  (hossman)
+
+
 Other Changes
 ----------------------
 

Modified: lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/schema/IndexSchema.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/schema/IndexSchema.java?rev=1098764&r1=1098763&r2=1098764&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/schema/IndexSchema.java (original)
+++ lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/schema/IndexSchema.java Mon
May  2 19:47:21 2011
@@ -823,19 +823,23 @@ public final class IndexSchema {
     NamedNodeMap attrs = node.getAttributes();
     String analyzerName = DOMUtil.getAttr(attrs,"class");
     if (analyzerName != null) {
-      // No need to be core-aware as Analyzers are not in the core-aware list
-      final Class<? extends Analyzer> clazz = loader.findClass(analyzerName).asSubclass(Analyzer.class);
       try {
+        // No need to be core-aware as Analyzers are not in the core-aware list
+        final Class<? extends Analyzer> clazz = loader.findClass
+          (analyzerName).asSubclass(Analyzer.class);
+
         try {
-          // first try to use a ctor with version parameter (needed for many new Analyzers
that have no default one anymore)
+          // first try to use a ctor with version parameter 
+          // (needed for many new Analyzers that have no default one anymore)
           Constructor<? extends Analyzer> cnstr = clazz.getConstructor(Version.class);
           final String matchVersionStr = DOMUtil.getAttr(attrs, LUCENE_MATCH_VERSION_PARAM);
           final Version luceneMatchVersion = (matchVersionStr == null) ?
             solrConfig.luceneMatchVersion : Config.parseLuceneVersionString(matchVersionStr);
           if (luceneMatchVersion == null) {
-            throw new SolrException( SolrException.ErrorCode.SERVER_ERROR,
-              "Configuration Error: Analyzer '" + clazz.getName() +
-              "' needs a 'luceneMatchVersion' parameter");
+            throw new SolrException
+              ( SolrException.ErrorCode.SERVER_ERROR,
+                "Configuration Error: Analyzer '" + clazz.getName() +
+                "' needs a 'luceneMatchVersion' parameter");
           }
           return cnstr.newInstance(luceneMatchVersion);
         } catch (NoSuchMethodException nsme) {
@@ -843,8 +847,9 @@ public final class IndexSchema {
           return clazz.newInstance();
         }
       } catch (Exception e) {
+        log.error("Cannot load analyzer: "+analyzerName, e);
         throw new SolrException( SolrException.ErrorCode.SERVER_ERROR,
-              "Cannot load analyzer: "+analyzerName );
+                                 "Cannot load analyzer: "+analyzerName, e );
       }
     }
 



Mime
View raw message