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){