close log file stream

This commit is contained in:
Dave Brosius 2015-12-30 21:28:54 -05:00
parent 2a6aa8cfb7
commit bcbb53b7de
1 changed files with 17 additions and 17 deletions

View File

@ -234,28 +234,28 @@ public class StressGraph
private JSONObject createJSONStats(JSONObject json)
{
JSONArray stats;
if (json == null)
try (InputStream logStream = new FileInputStream(stressSettings.graph.temporaryLogFile))
{
json = new JSONObject();
stats = new JSONArray();
}
else
{
stats = (JSONArray) json.get("stats");
}
JSONArray stats;
if (json == null)
{
json = new JSONObject();
stats = new JSONArray();
}
else
{
stats = (JSONArray) json.get("stats");
}
try
{
stats = parseLogStats(new FileInputStream(stressSettings.graph.temporaryLogFile), stats);
stats = parseLogStats(logStream, stats);
json.put("title", stressSettings.graph.title);
json.put("stats", stats);
return json;
}
catch (FileNotFoundException e)
catch (IOException e)
{
throw new RuntimeException(e);
}
json.put("title", stressSettings.graph.title);
json.put("stats", stats);
return json;
}
}