lucene-solr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From no...@apache.org
Subject svn commit: r892775 - in /lucene/solr/trunk/contrib/dataimporthandler: ./ src/extras/main/java/org/apache/solr/handler/dataimport/ src/main/java/org/apache/solr/handler/dataimport/
Date Mon, 21 Dec 2009 11:42:55 GMT
Author: noble
Date: Mon Dec 21 11:42:55 2009
New Revision: 892775

URL: http://svn.apache.org/viewvc?rev=892775&view=rev
Log:
SOLR-1678 Move onError handling to DIH framework

Modified:
    lucene/solr/trunk/contrib/dataimporthandler/CHANGES.txt
    lucene/solr/trunk/contrib/dataimporthandler/src/extras/main/java/org/apache/solr/handler/dataimport/TikaEntityProcessor.java
    lucene/solr/trunk/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/EntityProcessorWrapper.java
    lucene/solr/trunk/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/PlainTextEntityProcessor.java

Modified: lucene/solr/trunk/contrib/dataimporthandler/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/contrib/dataimporthandler/CHANGES.txt?rev=892775&r1=892774&r2=892775&view=diff
==============================================================================
--- lucene/solr/trunk/contrib/dataimporthandler/CHANGES.txt (original)
+++ lucene/solr/trunk/contrib/dataimporthandler/CHANGES.txt Mon Dec 21 11:42:55 2009
@@ -33,6 +33,8 @@
 
 * SOLR-1654 : TikaEntityProcessor example added DIHExample (Akshay Ukey via noble)
 
+* SOLR-1678 :  Move onError handling to DIH framework (noble)
+
 
 Optimizations
 ----------------------

Modified: lucene/solr/trunk/contrib/dataimporthandler/src/extras/main/java/org/apache/solr/handler/dataimport/TikaEntityProcessor.java
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/contrib/dataimporthandler/src/extras/main/java/org/apache/solr/handler/dataimport/TikaEntityProcessor.java?rev=892775&r1=892774&r2=892775&view=diff
==============================================================================
--- lucene/solr/trunk/contrib/dataimporthandler/src/extras/main/java/org/apache/solr/handler/dataimport/TikaEntityProcessor.java
(original)
+++ lucene/solr/trunk/contrib/dataimporthandler/src/extras/main/java/org/apache/solr/handler/dataimport/TikaEntityProcessor.java
Mon Dec 21 11:42:55 2009
@@ -123,12 +123,7 @@
     try {
       tikaParser.parse(is, contentHandler, metadata , new ParseContext());
     } catch (Exception e) {
-      if(ABORT.equals(onError)){
-        wrapAndThrow(SEVERE, e, "Unable to read content");
-      } else {
-        LOG.warn("Unable to parse document "+ context.getResolvedEntityAttribute(URL) ,e);
-        return null;
-      }
+      wrapAndThrow(SEVERE, e, "Unable to read content");
     }
     IOUtils.closeQuietly(is);
     for (Map<String, String> field : context.getAllEntityFields()) {

Modified: lucene/solr/trunk/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/EntityProcessorWrapper.java
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/EntityProcessorWrapper.java?rev=892775&r1=892774&r2=892775&view=diff
==============================================================================
--- lucene/solr/trunk/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/EntityProcessorWrapper.java
(original)
+++ lucene/solr/trunk/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/EntityProcessorWrapper.java
Mon Dec 21 11:42:55 2009
@@ -232,7 +232,18 @@
       return getFromRowCache();
     }
     while (true) {
-      Map<String, Object> arow = delegate.nextRow();
+      Map<String, Object> arow = null;
+      try {
+        arow = delegate.nextRow();
+      } catch (Exception e) {
+        if(ABORT.equals(onError)){
+          wrapAndThrow(SEVERE, e);
+        } else {
+          //SKIP is not really possible. If this calls the nextRow() again the Entityprocessor
would be in an inconisttent state           
+          log.error("Exception in entity : "+ entityName, e);          
+          return null;
+        }
+      }
       if (arow == null) {
         return null;
       } else {

Modified: lucene/solr/trunk/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/PlainTextEntityProcessor.java
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/PlainTextEntityProcessor.java?rev=892775&r1=892774&r2=892775&view=diff
==============================================================================
--- lucene/solr/trunk/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/PlainTextEntityProcessor.java
(original)
+++ lucene/solr/trunk/contrib/dataimporthandler/src/main/java/org/apache/solr/handler/dataimport/PlainTextEntityProcessor.java
Mon Dec 21 11:42:55 2009
@@ -53,10 +53,7 @@
     try {
       r = ds.getData(url);
     } catch (Exception e) {
-      if (ABORT.equals(onError)) {
-        wrapAndThrow(SEVERE, e, "Exception reading url : " + url);
-      }
-      return null;
+      wrapAndThrow(SEVERE, e, "Exception reading url : " + url);
     }
     StringWriter sw = new StringWriter();
     char[] buf = new char[1024];
@@ -65,12 +62,8 @@
       try {
         len = r.read(buf);
       } catch (IOException e) {
-        if (ABORT.equals(onError)) {
-          wrapAndThrow(SEVERE, e, "Exception reading url : " + url);
-        } else {
-          LOG.warn("IOException while reading from data source", e);
-          return null;
-        }
+        IOUtils.closeQuietly(r);
+        wrapAndThrow(SEVERE, e, "Exception reading url : " + url);
       }
       if (len <= 0) break;
       sw.append(new String(buf, 0, len));



Mime
View raw message