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
|
@Subscribe
|
||||||
private void handle(FileSelectedEvent event) {
|
private void handle(FileSelectedEvent event) {
|
||||||
try {
|
try (Scanner sc = new Scanner(new File(event.getPath()))) {
|
||||||
Scanner sc = new Scanner(new File(event.getPath()));
|
|
||||||
editor.clear();
|
editor.clear();
|
||||||
while (sc.hasNextLine()) {
|
while (sc.hasNextLine()) {
|
||||||
editor.appendText(sc.nextLine());
|
editor.appendText(sc.nextLine());
|
||||||
|
Loading…
Reference in New Issue
Block a user