Browse Source

Close InputStream in finally block.

pull/57/head
Kalle Stenflo 10 years ago
parent
commit
313bf0b79b
  1. 4
      json-path/src/main/java/com/jayway/jsonpath/JsonPath.java
  2. 4
      json-path/src/main/java/com/jayway/jsonpath/internal/JsonReader.java

4
json-path/src/main/java/com/jayway/jsonpath/JsonPath.java

@ -330,11 +330,7 @@ public class JsonPath {
notNull(jsonInputStream, "json input stream can not be null");
notNull(configuration, "configuration can not be null");
try {
return read(jsonInputStream, "UTF-8", configuration);
} finally {
Utils.closeQuietly(jsonInputStream);
}
}
/**

4
json-path/src/main/java/com/jayway/jsonpath/internal/JsonReader.java

@ -72,8 +72,12 @@ public class JsonReader implements ParseContext, ReadContext {
public ReadContext parse(InputStream json, String charset) {
notNull(json, "json input stream can not be null");
notNull(json, "charset can not be null");
try {
this.json = configuration.jsonProvider().parse(json, charset);
return this;
} finally {
Utils.closeQuietly(json);
}
}
@Override

Loading…
Cancel
Save