diff options
author | relves | 2010-05-03 20:16:30 +0000 |
---|---|---|
committer | relves | 2010-05-03 20:16:30 +0000 |
commit | 036f18859b3f2881dc8542d0984c64c7ccdd894e (patch) | |
tree | 96ec8f54e267f72f864c5205506e517f02725d8e /org.eclipse.mylyn.oslc.core | |
parent | 5489329227a91e3ecb87f8a4d7d0acef42fc3c15 (diff) | |
download | org.eclipse.mylyn.tasks-036f18859b3f2881dc8542d0984c64c7ccdd894e.tar.gz org.eclipse.mylyn.tasks-036f18859b3f2881dc8542d0984c64c7ccdd894e.tar.xz org.eclipse.mylyn.tasks-036f18859b3f2881dc8542d0984c64c7ccdd894e.zip |
NEW - bug 311426: [oslc] add cancellation back to AbstractOslcClient
https://bugs.eclipse.org/bugs/show_bug.cgi?id=311426
Diffstat (limited to 'org.eclipse.mylyn.oslc.core')
-rw-r--r-- | org.eclipse.mylyn.oslc.core/src/org/eclipse/mylyn/internal/oslc/core/client/AbstractOslcClient.java | 17 |
1 files changed, 8 insertions, 9 deletions
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> T executeMethod(HttpMethodBase method, RequestHandler<T> 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(); } |