lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From k...@apache.org
Subject svn commit: r1134167 - in /lucene/dev/branches/branch_3x: ./ lucene/ lucene/backwards/ solr/ solr/contrib/uima/ solr/contrib/uima/src/main/java/org/apache/solr/uima/processor/ solr/contrib/uima/src/test/java/org/apache/solr/uima/processor/
Date Fri, 10 Jun 2011 01:31:36 GMT
Author: koji
Date: Fri Jun 10 01:31:35 2011
New Revision: 1134167

URL: http://svn.apache.org/viewvc?rev=1134167&view=rev
Log:
SOLR-2579: UIMAUpdateRequestProcessor ignore error fails if text.length() < 100

Modified:
    lucene/dev/branches/branch_3x/   (props changed)
    lucene/dev/branches/branch_3x/lucene/   (props changed)
    lucene/dev/branches/branch_3x/lucene/backwards/   (props changed)
    lucene/dev/branches/branch_3x/solr/   (props changed)
    lucene/dev/branches/branch_3x/solr/contrib/uima/CHANGES.txt
    lucene/dev/branches/branch_3x/solr/contrib/uima/src/main/java/org/apache/solr/uima/processor/UIMAUpdateRequestProcessor.java
    lucene/dev/branches/branch_3x/solr/contrib/uima/src/test/java/org/apache/solr/uima/processor/UIMAUpdateRequestProcessorTest.java

Modified: lucene/dev/branches/branch_3x/solr/contrib/uima/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/solr/contrib/uima/CHANGES.txt?rev=1134167&r1=1134166&r2=1134167&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/solr/contrib/uima/CHANGES.txt (original)
+++ lucene/dev/branches/branch_3x/solr/contrib/uima/CHANGES.txt Fri Jun 10 01:31:35 2011
@@ -20,8 +20,12 @@ WhitespaceTokenizer v2.3.1-SNAPSHOT rev.
 $Id$
 
 ==================  3.3.0-dev ==============
+  
+Bug Fixes
+----------------------
 
-(No Changes)
+* SOLR-2579: UIMAUpdateRequestProcessor ignore error fails if text.length() < 100.
+  (Elmer Garduno via koji)
 
 ==================  3.2.0 ==================
 

Modified: lucene/dev/branches/branch_3x/solr/contrib/uima/src/main/java/org/apache/solr/uima/processor/UIMAUpdateRequestProcessor.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/solr/contrib/uima/src/main/java/org/apache/solr/uima/processor/UIMAUpdateRequestProcessor.java?rev=1134167&r1=1134166&r2=1134167&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/solr/contrib/uima/src/main/java/org/apache/solr/uima/processor/UIMAUpdateRequestProcessor.java
(original)
+++ lucene/dev/branches/branch_3x/solr/contrib/uima/src/main/java/org/apache/solr/uima/processor/UIMAUpdateRequestProcessor.java
Fri Jun 10 01:31:35 2011
@@ -89,15 +89,16 @@ public class UIMAUpdateRequestProcessor 
         new StringBuilder(". ").append(logField).append("=")
         .append((String)cmd.getSolrInputDocument().getField(logField).getValue())
         .append(", ").toString();
-      if (solrUIMAConfiguration.isIgnoreErrors())
+      int len = Math.min(text.length(), 100);
+      if (solrUIMAConfiguration.isIgnoreErrors()) {
         log.warn(new StringBuilder("skip the text processing due to ")
           .append(e.getLocalizedMessage()).append(optionalFieldInfo)
-          .append(" text=\"").append(text.substring(0, 100)).append("...\"").toString());
-      else{
+          .append(" text=\"").append(text.substring(0, len)).append("...\"").toString());
+      } else {
         throw new SolrException(ErrorCode.SERVER_ERROR,
             new StringBuilder("processing error: ")
               .append(e.getLocalizedMessage()).append(optionalFieldInfo)
-              .append(" text=\"").append(text.substring(0, 100)).append("...\"").toString(),
e);
+              .append(" text=\"").append(text.substring(0, len)).append("...\"").toString(),
e);
       }
     }
     super.processAdd(cmd);

Modified: lucene/dev/branches/branch_3x/solr/contrib/uima/src/test/java/org/apache/solr/uima/processor/UIMAUpdateRequestProcessorTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/solr/contrib/uima/src/test/java/org/apache/solr/uima/processor/UIMAUpdateRequestProcessorTest.java?rev=1134167&r1=1134166&r2=1134167&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/solr/contrib/uima/src/test/java/org/apache/solr/uima/processor/UIMAUpdateRequestProcessorTest.java
(original)
+++ lucene/dev/branches/branch_3x/solr/contrib/uima/src/test/java/org/apache/solr/uima/processor/UIMAUpdateRequestProcessorTest.java
Fri Jun 10 01:31:35 2011
@@ -24,6 +24,7 @@ import java.util.HashMap;
 import java.util.Map;
 
 import org.apache.solr.SolrTestCaseJ4;
+import org.apache.solr.common.SolrException;
 import org.apache.solr.common.params.MultiMapSolrParams;
 import org.apache.solr.common.params.SolrParams;
 import org.apache.solr.common.params.UpdateParams;
@@ -158,6 +159,30 @@ public class UIMAUpdateRequestProcessorT
                     + " Last Lucene European Conference has been held in Prague."));
     assertU(commit());
     assertQ(req("*:*"), "//*[@numFound='1']");
+
+    try{
+      addDoc("uima-not-ignoreErrors", adoc(
+            "id",
+            "2312312321312",
+            "text",
+            "SpellCheckComponent got improvement related to recent Lucene changes."));
+      fail("exception shouldn't be ignored");
+    }
+    catch(StringIndexOutOfBoundsException e){  // SOLR-2579
+      fail("exception shouldn't be raised");
+    }
+    catch(SolrException expected){}
+
+    try{
+      addDoc("uima-ignoreErrors", adoc(
+            "id",
+            "2312312321312",
+            "text",
+            "SpellCheckComponent got improvement related to recent Lucene changes."));
+    }
+    catch(StringIndexOutOfBoundsException e){  // SOLR-2579
+      fail("exception shouldn't be raised");
+    }
   }
 
   private void addDoc(String chain, String doc) throws Exception {



Mime
View raw message