# HG changeset patch # User Dmitry Neverov # Date 1499855980 -7200 # Node ID 0a31f12174ca6b9169cb5cbf703b49cfe26d1549 # Parent c5dc2c802e4b3d3e1145e745394f4d9234ba9076 TW-50245 catch errors during GetMethod creation diff -r c5dc2c802e4b -r 0a31f12174ca mercurial-server/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/MercurialUrlSupport.java --- a/mercurial-server/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/MercurialUrlSupport.java Thu Jun 22 12:54:00 2017 +0200 +++ b/mercurial-server/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/MercurialUrlSupport.java Wed Jul 12 12:39:40 2017 +0200 @@ -97,9 +97,10 @@ } HttpClient client = HttpUtil.createHttpClient(30); - GetMethod get = new GetMethod(capabilitiesUrl); + GetMethod get = null; try { + get = new GetMethod(capabilitiesUrl); if (credentials != null) { URL url = new URL(fetchUrl); HttpState state = new HttpState(); @@ -129,7 +130,8 @@ } catch (Exception e) { Loggers.VCS.debug("Got error while sending HTTP request to " + capabilitiesUrl, e); } finally { - get.releaseConnection(); + if (get != null) + get.releaseConnection(); } return false;