File tree Expand file tree Collapse file tree 1 file changed +4
-1
lines changed
src/main/java/com/ibm/watson/developer_cloud/util Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change 1515
1616import java .io .IOException ;
1717import java .io .InputStream ;
18+ import java .io .Reader ;
1819import java .util .logging .Level ;
1920import java .util .logging .Logger ;
2021
@@ -99,8 +100,10 @@ public static JsonObject getJsonObject(String jsonString) {
99100 public static <T extends GenericModel > T getObject (Response response , Class <T > type ) {
100101 JsonReader reader ;
101102 try {
102- reader = new JsonReader (response .body ().charStream ());
103+ Reader stream = response .body ().charStream ();
104+ reader = new JsonReader (stream );
103105 final T model = GsonSingleton .getGsonWithoutPrettyPrinting ().fromJson (reader , type );
106+ stream .close ();
104107 return model ;
105108 } catch (IOException e ) {
106109 log .log (Level .SEVERE , ERROR_MESSAGE , e );
You can’t perform that action at this time.
0 commit comments