File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed
src/main/java/se/walkercrou/places Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -64,21 +64,25 @@ private String readString(HttpResponse response) throws IOException {
64
64
65
65
@ Override
66
66
public InputStream getInputStream (String uri ) throws IOException {
67
+ HttpGet get = new HttpGet (uri );
67
68
try {
68
- HttpGet get = new HttpGet (uri );
69
69
return client .execute (get ).getEntity ().getContent ();
70
70
} catch (Exception e ) {
71
71
throw new IOException (e );
72
+ } finally {
73
+ get .releaseConnection ();
72
74
}
73
75
}
74
76
75
77
@ Override
76
78
public String get (String uri ) throws IOException {
79
+ HttpGet get = new HttpGet (uri );
77
80
try {
78
- HttpGet get = new HttpGet (uri );
79
81
return readString (client .execute (get ));
80
82
} catch (Exception e ) {
81
83
throw new IOException (e );
84
+ } finally {
85
+ get .releaseConnection ();
82
86
}
83
87
}
84
88
@@ -88,6 +92,8 @@ public String post(HttpPost data) throws IOException {
88
92
return readString (client .execute (data ));
89
93
} catch (Exception e ) {
90
94
throw new IOException (e );
95
+ } finally {
96
+ data .releaseConnection ();
91
97
}
92
98
}
93
99
}
You can’t perform that action at this time.
0 commit comments