You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@manifoldcf.apache.org by kw...@apache.org on 2014/06/17 22:05:01 UTC

svn commit: r1603282 - /manifoldcf/trunk/connectors/rss/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/rss/RSSConnector.java

Author: kwright
Date: Tue Jun 17 20:05:00 2014
New Revision: 1603282

URL: http://svn.apache.org/r1603282
Log:
Fix CONNECTORS-966 for rss connector

Modified:
    manifoldcf/trunk/connectors/rss/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/rss/RSSConnector.java

Modified: manifoldcf/trunk/connectors/rss/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/rss/RSSConnector.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/connectors/rss/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/rss/RSSConnector.java?rev=1603282&r1=1603281&r2=1603282&view=diff
==============================================================================
--- manifoldcf/trunk/connectors/rss/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/rss/RSSConnector.java (original)
+++ manifoldcf/trunk/connectors/rss/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/rss/RSSConnector.java Tue Jun 17 20:05:00 2014
@@ -1503,25 +1503,24 @@ public class RSSConnector extends org.ap
               try
               {
                 rd.setBinary(is,dataSize);
-                activities.ingestDocument(urlValue,version,ingestURL,rd);
-              }
-              finally
-              {
                 try
                 {
-                  is.close();
+                  activities.ingestDocumentWithException(urlValue,version,ingestURL,rd);
                 }
-                catch (java.net.SocketTimeoutException e)
+                catch (IOException e)
                 {
-                  throw new ManifoldCFException("IO error closing stream: "+e.getMessage(),e);
+                  handleIOException(e,"reading data");
                 }
-                catch (InterruptedIOException e)
+              }
+              finally
+              {
+                try
                 {
-                  throw new ManifoldCFException("Interrupted: "+e.getMessage(),e,ManifoldCFException.INTERRUPTED);
+                  is.close();
                 }
                 catch (IOException e)
                 {
-                  throw new ManifoldCFException("IO error closing stream: "+e.getMessage(),e);
+                  handleIOException(e,"closing stream");
                 }
               }
             }
@@ -1545,6 +1544,17 @@ public class RSSConnector extends org.ap
 
   }
 
+  protected static void handleIOException(IOException e, String context)
+    throws ManifoldCFException, ServiceInterruption
+  {
+    if (e instanceof java.net.SocketTimeoutException)
+      throw new ManifoldCFException("IO error "+context+": "+e.getMessage(),e);
+    else if (e instanceof InterruptedIOException)
+      throw new ManifoldCFException("Interrupted: "+e.getMessage(),e,ManifoldCFException.INTERRUPTED);
+    else
+      throw new ManifoldCFException("IO error "+context+": "+e.getMessage(),e);
+  }
+  
   /** Free a set of documents.  This method is called for all documents whose versions have been fetched using
   * the getDocumentVersions() method, including those that returned null versions.  It may be used to free resources
   * committed during the getDocumentVersions() method.  It is guaranteed to be called AFTER any calls to