Skip to content

Commit

Permalink
Close the file when things go wrong.
Browse files Browse the repository at this point in the history
  • Loading branch information
Mailaender committed Nov 2, 2021
1 parent 29247c7 commit 7491b78
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2018, 2020 Lablicate GmbH.
* Copyright (c) 2018, 2021 Lablicate GmbH.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
Expand Down Expand Up @@ -50,8 +50,7 @@ public ISeparationColumnIndices parse(File file) {

ISeparationColumnIndices separationColumnIndices = new SeparationColumnIndices();
//
try {
BufferedReader bufferedReader = new BufferedReader(new FileReader(file));
try (BufferedReader bufferedReader = new BufferedReader(new FileReader(file))) {
/*
* Column Specification
*/
Expand Down Expand Up @@ -119,8 +118,6 @@ public ISeparationColumnIndices parse(File file) {
*/
ISeparationColumn separationColumn = new SeparationColumn(name, length, diameter, phase);
separationColumnIndices.setSeparationColumn(separationColumn);
//
bufferedReader.close();
} catch(IOException e) {
logger.error(e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@ private ISeparationColumn extractSeparationColumn(File file) {
*/
ISeparationColumn separationColumn = SeparationColumnFactory.getSeparationColumn(SeparationColumnFactory.TYPE_DEFAULT);
//
try {
BufferedReader bufferedReader = new BufferedReader(new FileReader(file));
try (BufferedReader bufferedReader = new BufferedReader(new FileReader(file))) {
/*
* Column Specification
*/
Expand Down Expand Up @@ -81,7 +80,6 @@ private ISeparationColumn extractSeparationColumn(File file) {
* Create the column.
*/
separationColumn = new SeparationColumn(name, length, diameter, phase);
bufferedReader.close();
} catch(IOException e) {
logger.error(e);
}
Expand Down

0 comments on commit 7491b78

Please sign in to comment.