HttpResponse response = this.client.execute(this.host, post);
int responseCode = response.getStatusLine().getStatusCode();
+
+ //
+ // Retrieve the inputstream BEFORE checking the status code so
+ // resources get freed in the finally clause.
+ //
+
+ is = response.getEntity().getContent();
if (responseCode != HttpStatus.SC_OK) {
throw new TTransportException("HTTP Response code: " + responseCode);
// Proceeding differently might lead to exhaustion of connections and thus
// to app failure.
- is = response.getEntity().getContent();
-
byte[] buf = new byte[1024];
ByteArrayOutputStream baos = new ByteArrayOutputStream();