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