You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@manifoldcf.apache.org by "Piergiorgio Lucidi (JIRA)" <ji...@apache.org> on 2013/06/12 14:42:21 UTC
[jira] [Comment Edited] (CONNECTORS-713) Alfresco connector needs
to deal with IOExceptions better
[ https://issues.apache.org/jira/browse/CONNECTORS-713?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13681172#comment-13681172 ]
Piergiorgio Lucidi edited comment on CONNECTORS-713 at 6/12/13 12:41 PM:
-------------------------------------------------------------------------
It could exists another bug in the getContentProperties method, I think that there is a problem.
It could make sense to have a similar stacktrace if something goes wrong there.
was (Author: piergiorgiolucidi@gmail.com):
It could be bug in the getContentProperties method, I think that there is a problem.
It could make sense to have a similar stacktrace if something goes wrong there.
> Alfresco connector needs to deal with IOExceptions better
> ---------------------------------------------------------
>
> Key: CONNECTORS-713
> URL: https://issues.apache.org/jira/browse/CONNECTORS-713
> Project: ManifoldCF
> Issue Type: Bug
> Components: Alfresco connector
> Affects Versions: ManifoldCF 1.2
> Reporter: Karl Wright
> Assignee: Piergiorgio Lucidi
> Fix For: ManifoldCF 1.3
>
>
> The Alfresco Connector deals with IOExceptions by just tossing a wrapping ManifoldCFException. This is a problem for several reasons. First, IOExceptions are usually transient, and should mostly be converted into ServiceInterruptions instead. Second, IOExceptions *may* represent thread interrupts, in which case the software should instead throw new ManifoldCFException(<msg>, ManifoldCFException.INTERRUPTED).
> A good model is to have a method called "void handleIOException(IOException) throws ServiceInterruption, ManifoldCFException" called from everywhere that IOExceptions are caught. Usually they get implemented something like this, although you can also throw ServiceInterruptions with different characteristics dependent on the kind of IOException being caught:
> {code}
> private static void handleIOException(IOException e)
> throws ManifoldCFException, ServiceInterruption {
> if (!(e instanceof java.net.SocketTimeoutException) && (e instanceof InterruptedIOException)) {
> throw new ManifoldCFException("Interrupted: " + e.getMessage(), e,
> ManifoldCFException.INTERRUPTED);
> }
> long currentTime = System.currentTimeMillis();
> throw new ServiceInterruption("IO exception: "+e.getMessage(), e, currentTime + 300000L,
> currentTime + 3 * 60 * 60000L,-1,false);
> }
> {code}
> The exception returned is the following:
> {code}
> FATAL 2013-06-11 16:40:03,441 (Worker thread '12') - Error tossed: Unable to get content as inputStream.
> org.alfresco.webservice.util.WebServiceException: Unable to get content as inputStream.
> at org.alfresco.webservice.util.ContentUtils.getContentAsInputStream(ContentUtils.java:139)
> at org.apache.manifoldcf.crawler.connectors.alfresco.ContentReader.getBinary(ContentReader.java:73)
> at org.apache.manifoldcf.crawler.connectors.alfresco.AlfrescoRepositoryConnector.processDocuments(AlfrescoRepositoryConnector.java:824)
> at org.apache.manifoldcf.crawler.connectors.BaseRepositoryConnector.processDocuments(BaseRepositoryConnector.java:423)
> at org.apache.manifoldcf.crawler.system.WorkerThread.run(WorkerThread.java:559)
> Caused by: java.io.IOException: Server returned HTTP response code: 500 for URL: http://localhost:9090/alfresco/download/direct/workspace/SpacesStore/1e4f7fe4-d58a-4d69-b26f-3349546af7ca/testdata2.txt?ticket=TICKET_33ac1ec81c5b0ca9d024f0489df115286d0ac030
> at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1625)
> at org.alfresco.webservice.util.ContentUtils.getContentAsInputStream(ContentUtils.java:135)
> ... 4 more
> {code}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira