From 0d74b00487e2bd05b681f3590ae8579f731982d0 Mon Sep 17 00:00:00 2001 From: RatzzFatzz Date: Fri, 10 Apr 2020 20:51:18 +0200 Subject: [PATCH] [FIX] close scanner --- .../AttributeUpdaterKernel.java | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/main/java/at/pcgamingfreaks/mkvaudiosubtitlechanger/AttributeUpdaterKernel.java b/src/main/java/at/pcgamingfreaks/mkvaudiosubtitlechanger/AttributeUpdaterKernel.java index a174554..c67b179 100644 --- a/src/main/java/at/pcgamingfreaks/mkvaudiosubtitlechanger/AttributeUpdaterKernel.java +++ b/src/main/java/at/pcgamingfreaks/mkvaudiosubtitlechanger/AttributeUpdaterKernel.java @@ -18,17 +18,17 @@ public class AttributeUpdaterKernel { public void execute() { List configPattern = ConfigUtil.loadConfig(); - Scanner scanner = new Scanner(System.in); - System.out.println("Please enter the path to the files which should be updated: "); List allValidPaths = null; - do{ - allValidPaths = collector.loadFiles(scanner.nextLine()); - if(allValidPaths == null){ - System.out.println("Please enter a valid path: "); - } - }while(allValidPaths == null); - log.info(allValidPaths.size() + " files where found and will now be processed!"); - + try(Scanner scanner = new Scanner(System.in)){ + System.out.println("Please enter the path to the files which should be updated: "); + do{ + allValidPaths = collector.loadFiles(scanner.nextLine()); + if(allValidPaths == null){ + System.out.println("Please enter a valid path: "); + } + }while(allValidPaths == null); + log.info(allValidPaths.size() + " files where found and will now be processed!"); + } for(File file : allValidPaths){ List attributes = collector.loadAttributes(file); for(AttributeConfig config : configPattern){