Karl Wright created CONNECTORS-713:
--------------------------------------
Summary: 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}
--
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