Skip to content

Commit

Permalink
fix(template): should truly close the inputstream
Browse files Browse the repository at this point in the history
  • Loading branch information
Thuan Vo committed Jun 22, 2023
1 parent 1e0c034 commit b5d053e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@ public ProbeTemplate addTemplate(InputStream inputStream, String filename)
throws FileAlreadyExistsException, IOException, SAXException {
Path path = fs.pathOf(env.getEnv(TEMPLATE_PATH), filename);
if (fs.exists(path)) {
throw new FileAlreadyExistsException(filename);
throw new FileAlreadyExistsException(
String.format("Probe template \"%s\" already exists.", filename));
}
try (inputStream) {
ProbeTemplate template = new ProbeTemplate();
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/io/cryostat/core/agent/ProbeTemplate.java
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public void deserialize(InputStream xmlStream) throws IOException, SAXException
}

Document document = builder.parse(stream);
stream.close();
stream.trulyClose();
NodeList elements;

// parse global configurations
Expand Down

0 comments on commit b5d053e

Please sign in to comment.