Fix scanner memory leak issue

This commit is contained in:
Oystein Kristoffer Tveit 2021-03-01 14:10:54 +01:00
parent 73e2f15232
commit 1626f79ffa
1 changed files with 1 additions and 2 deletions

View File

@ -127,8 +127,7 @@ public class EditorController implements Initializable, Controller {
@Subscribe
private void handle(FileSelectedEvent event) {
try {
Scanner sc = new Scanner(new File(event.getPath()));
try (Scanner sc = new Scanner(new File(event.getPath()))) {
editor.clear();
while (sc.hasNextLine()) {
editor.appendText(sc.nextLine());