From 036f18859b3f2881dc8542d0984c64c7ccdd894e Mon Sep 17 00:00:00 2001 From: relves Date: Mon, 3 May 2010 20:16:30 +0000 Subject: NEW - bug 311426: [oslc] add cancellation back to AbstractOslcClient https://bugs.eclipse.org/bugs/show_bug.cgi?id=311426 --- .../internal/oslc/core/client/AbstractOslcClient.java | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'org.eclipse.mylyn.oslc.core') diff --git a/org.eclipse.mylyn.oslc.core/src/org/eclipse/mylyn/internal/oslc/core/client/AbstractOslcClient.java b/org.eclipse.mylyn.oslc.core/src/org/eclipse/mylyn/internal/oslc/core/client/AbstractOslcClient.java index b70521d98..a85005218 100644 --- a/org.eclipse.mylyn.oslc.core/src/org/eclipse/mylyn/internal/oslc/core/client/AbstractOslcClient.java +++ b/org.eclipse.mylyn.oslc.core/src/org/eclipse/mylyn/internal/oslc/core/client/AbstractOslcClient.java @@ -33,7 +33,6 @@ import org.apache.commons.httpclient.methods.GetMethod; import org.apache.commons.httpclient.methods.PostMethod; import org.apache.commons.httpclient.methods.PutMethod; import org.apache.commons.httpclient.methods.StringRequestEntity; -import org.eclipse.core.runtime.Assert; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IStatus; @@ -559,23 +558,23 @@ public abstract class AbstractOslcClient { protected T executeMethod(HttpMethodBase method, RequestHandler handler, IProgressMonitor monitor) throws CoreException { - Assert.isNotNull(method); monitor = Policy.monitorFor(monitor); try { monitor.beginTask(handler.getRequestName(), IProgressMonitor.UNKNOWN); HostConfiguration hostConfiguration = WebUtil.createHostConfiguration(httpClient, location, monitor); - try { - int code = WebUtil.execute(httpClient, hostConfiguration, method, monitor); - handler.handleReturnCode(code, method); - return handler.run(method, monitor); - } finally { - WebUtil.releaseConnection(method, monitor); - } + int code = WebUtil.execute(httpClient, hostConfiguration, method, monitor); + + handler.handleReturnCode(code, method); + + return handler.run(method, monitor); } catch (IOException e) { throw new CoreException(new Status(IStatus.WARNING, IOslcCoreConstants.ID_PLUGIN, "An unexpected network error has occurred: " + e.getMessage(), e)); //$NON-NLS-1$ } finally { + if (method != null) { + method.releaseConnection(); + } monitor.done(); } -- cgit v1.2.3