Skip to content

Commit e5fce41

Browse files
Close the input stream for JSON HTTP responses after we read the json.
1 parent a75fab5 commit e5fce41

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/main/java/com/ibm/watson/developer_cloud/util/ResponseUtil.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,12 @@ public static <T extends GenericModel> T getObject(Response response, Class<T> t
105105
} catch (IOException e) {
106106
log.log(Level.SEVERE, ERROR_MESSAGE, e);
107107
throw new RuntimeException(ERROR_MESSAGE, e);
108+
} finally {
109+
try {
110+
response.body().close();
111+
} catch (IOException e) {
112+
log.log(Level.SEVERE,"Error closing the HTTP Response", e);
113+
}
108114
}
109115
}
110116

0 commit comments

Comments
 (0)