Commit aec664c9 authored by Tim Olshansky's avatar Tim Olshansky

Merge pull request #61 from openwide-java/master

Disconnect the HTTPURLConnection after use (Fixes #59).
parents 8c85a4e0 25cdadd9
......@@ -108,7 +108,9 @@ public class GitlabHTTPRequestor {
* @throws java.io.IOException on gitlab api error
*/
public <T> T to(String tailAPIUrl, Class<T> type, T instance) throws IOException {
HttpURLConnection connection = setupConnection(root.getAPIUrl(tailAPIUrl));
HttpURLConnection connection = null;
try {
connection = setupConnection(root.getAPIUrl(tailAPIUrl));
if (hasOutput()) {
submitData(connection);
......@@ -125,6 +127,11 @@ public class GitlabHTTPRequestor {
}
return null;
} finally {
if (connection != null) {
connection.disconnect();
}
}
}
public <T> List<T> getAll(final String tailUrl, final Class<T[]> type) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment