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:17:39 UTC
svn commit: r1603284 -
/manifoldcf/trunk/connectors/sharepoint/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/sharepoint/SharePointRepository.java
Author: kwright
Date: Tue Jun 17 20:17:39 2014
New Revision: 1603284
URL: http://svn.apache.org/r1603284
Log:
Fix CONNECTORS-966 for sharepoint connector
Modified:
manifoldcf/trunk/connectors/sharepoint/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/sharepoint/SharePointRepository.java
Modified: manifoldcf/trunk/connectors/sharepoint/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/sharepoint/SharePointRepository.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/connectors/sharepoint/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/sharepoint/SharePointRepository.java?rev=1603284&r1=1603283&r2=1603284&view=diff
==============================================================================
--- manifoldcf/trunk/connectors/sharepoint/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/sharepoint/SharePointRepository.java (original)
+++ manifoldcf/trunk/connectors/sharepoint/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/sharepoint/SharePointRepository.java Tue Jun 17 20:17:39 2014
@@ -1513,8 +1513,14 @@ public class SharePointRepository extend
}
}
data.addField("GUID",guid);
-
- activities.ingestDocument( documentIdentifier, version, itemUrl , data );
+ try
+ {
+ activities.ingestDocumentWithException( documentIdentifier, version, itemUrl , data );
+ }
+ catch (IOException e)
+ {
+ handleIOException(e,"reading document");
+ }
}
finally
{
@@ -1522,13 +1528,9 @@ public class SharePointRepository extend
{
is.close();
}
- catch (InterruptedIOException e)
- {
- throw new ManifoldCFException("Interrupted: "+e.getMessage(),e,ManifoldCFException.INTERRUPTED);
- }
catch (IOException e)
{
- // This should never happen; we're closing a bytearrayinputstream
+ handleIOException(e,"closing stream");
}
}
}
@@ -2008,7 +2010,14 @@ public class SharePointRepository extend
}
data.addField("GUID",guid);
- activities.ingestDocument( documentIdentifier, version, fileUrl , data );
+ try
+ {
+ activities.ingestDocumentWithException( documentIdentifier, version, fileUrl , data );
+ }
+ catch (IOException e)
+ {
+ handleIOException(e,"reading document");
+ }
return true;
}
finally
@@ -2085,6 +2094,27 @@ public class SharePointRepository extend
}
}
+ protected static void handleIOException(IOException e, String context)
+ throws ManifoldCFException, ServiceInterruption
+ {
+ if (e instanceof java.net.SocketTimeoutException)
+ {
+ long currentTime = System.currentTimeMillis();
+ throw new ServiceInterruption("SharePoint is down attempting to "+context+", retrying: "+e.getMessage(),e,currentTime + 300000L,
+ currentTime + 12 * 60 * 60000L,-1,true);
+ }
+ else if (e instanceof org.apache.http.conn.ConnectTimeoutException)
+ {
+ long currentTime = System.currentTimeMillis();
+ throw new ServiceInterruption("SharePoint is down attempting to "+context+", retrying: "+e.getMessage(),e,currentTime + 300000L,
+ currentTime + 12 * 60 * 60000L,-1,true);
+ }
+ else if (e instanceof InterruptedIOException)
+ throw new ManifoldCFException(e.getMessage(),e,ManifoldCFException.INTERRUPTED);
+ else
+ throw new ManifoldCFException(e.getMessage(),e);
+ }
+
/** Map an extension to a mime type */
protected static String mapExtensionToMimeType(String fileName)
{