manifoldcf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kwri...@apache.org
Subject svn commit: r1603255 - /manifoldcf/trunk/connectors/cmis/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/cmis/CmisRepositoryConnector.java
Date Tue, 17 Jun 2014 18:58:19 GMT
Author: kwright
Date: Tue Jun 17 18:58:18 2014
New Revision: 1603255

URL: http://svn.apache.org/r1603255
Log:
Fix CONNECTORS-966 for CMIS connector

Modified:
    manifoldcf/trunk/connectors/cmis/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/cmis/CmisRepositoryConnector.java

Modified: manifoldcf/trunk/connectors/cmis/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/cmis/CmisRepositoryConnector.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/connectors/cmis/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/cmis/CmisRepositoryConnector.java?rev=1603255&r1=1603254&r2=1603255&view=diff
==============================================================================
--- manifoldcf/trunk/connectors/cmis/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/cmis/CmisRepositoryConnector.java
(original)
+++ manifoldcf/trunk/connectors/cmis/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/cmis/CmisRepositoryConnector.java
Tue Jun 17 18:58:18 2014
@@ -1218,34 +1218,44 @@ public class CmisRepositoryConnector ext
           //documentURI
           String documentURI = CmisRepositoryConnectorUtils.getDocumentURL(document, session);
           
-          activities.ingestDocument(id, version, documentURI, rd);
-
+          try {
+            activities.ingestDocumentWithException(id, version, documentURI, rd);
+          } catch (IOException e) {
+            errorCode = "IO ERROR";
+            errorDesc = e.getMessage();
+            handleIOException(e, "reading file input stream");
+          }
         } finally {
           try {
             if(is!=null){
               is.close();
             }
-          } catch (InterruptedIOException e) {
-            errorCode = "Interrupted error";
-            errorDesc = e.getMessage();
-            throw new ManifoldCFException(e.getMessage(), e,
-                ManifoldCFException.INTERRUPTED);
           } catch (IOException e) {
             errorCode = "IO ERROR";
             errorDesc = e.getMessage();
-            Logging.connectors.warn(
-                "CMIS: IOException closing file input stream: "
-                    + e.getMessage(), e);
-          }
-
-          activities.recordActivity(new Long(startTime), ACTIVITY_READ,
+            handleIOException(e, "closing file input stream");
+          } finally {
+            activities.recordActivity(new Long(startTime), ACTIVITY_READ,
               fileLength, nodeId, errorCode, errorDesc, null);
+          }
         }
       }
       i++;
     }
   }
   
+  protected static void handleIOException(IOException e, String context) throws ManifoldCFException,
ServiceInterruption {
+    if (e instanceof InterruptedIOException) {
+      throw new ManifoldCFException(e.getMessage(), e,
+        ManifoldCFException.INTERRUPTED);
+    } else {
+      Logging.connectors.warn(
+        "CMIS: IOException "+context+": "
+          + e.getMessage(), e);
+      throw new ManifoldCFException(e.getMessage(), e);
+    }
+  }
+  
   /** The short version of getDocumentVersions.
    * Get document versions given an array of document identifiers.
    * This method is called for EVERY document that is considered. It is



Mime
View raw message