Fix scanner memory leak issue
This commit is contained in:
parent
73e2f15232
commit
1626f79ffa
@ -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());
|
||||
|
Loading…
Reference in New Issue
Block a user