diff --git a/src/site/xdoc/user-guide.xml b/src/site/xdoc/user-guide.xml index baf655a2..1e84a25b 100644 --- a/src/site/xdoc/user-guide.xml +++ b/src/site/xdoc/user-guide.xml @@ -39,16 +39,14 @@ for (CSVRecord record : records) { class from Apache Commons IO for example:

final URL url = ...; -final Reader reader = new InputStreamReader(new BOMInputStream(url.openStream()), "UTF-8"); -final CSVParser parser = new CSVParser(reader, CSVFormat.EXCEL.withHeader()); -try { +try ( + final Reader reader = new InputStreamReader(new BOMInputStream(url.openStream()), "UTF-8"); + final CSVParser parser = new CSVParser(reader, CSVFormat.EXCEL.withHeader()); +) { for (final CSVRecord record : parser) { final String string = record.get("SomeColumn"); ... } -} finally { - parser.close(); - reader.close(); }