Skip to content

Commit

Permalink
try-with-resources for the xmlwriter in the servlet (#8372)
Browse files Browse the repository at this point in the history
  • Loading branch information
landreev committed Jul 13, 2022
1 parent 3c8f225 commit e64a81d
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -238,10 +238,9 @@ private void processRequest(HttpServletRequest httpServletRequest, HttpServletRe
OAIPMH handle = dataProvider.handle(rawRequest);
response.setContentType("text/xml;charset=UTF-8");

XmlWriter xmlWriter = new XmlWriter(response.getOutputStream(), repositoryConfiguration);
xmlWriter.write(handle);
xmlWriter.flush();
xmlWriter.close();
try (XmlWriter xmlWriter = new XmlWriter(response.getOutputStream(), repositoryConfiguration);) {
xmlWriter.write(handle);
}

} catch (IOException ex) {
logger.warning("IO exception in Get; "+ex.getMessage());
Expand Down

0 comments on commit e64a81d

Please sign in to comment.