Hi everyone,
So, a little background on the situation, I wrote something the other day to call a few powershell scripts from a
java application, and ended up stripping out all the commands from the powershell script and calling them from java, which made the who process A LOT faster. What would take about 2 hours is now done in about 15 minutes. Anyway, a co-worker saw the code and asked me to compile it and if possible, give him a jar that he would run on his computer to do the same thing (for all my intents and purposes, I was just running it from eclipse).
I began writing a little menu for it, so that he can edit some settings, view them, and then start the process. While I was writing the menu and running some tests on it, I realized I was getting a very annoying bug when handling InputMismatchException from the scanner. I catch the exception, but then when it loops through the options again, the System.out.println I used in the catch block is printed again (like the exception is being thrown again) and it gets into an infinite loop, since the InputMismatchException is thrown over and over again. The pause you see in the catch block is just so I could stop the process in time to see what was going on, otherwise it would print things to the console way too fast.
This is such noobish question/issue, but I was hoping someone could give me some light
I'm not a developer (I wish! haha) but I do write some java every now and then when I see it could automate certain things and make our job easier. Anyway, I hope you guys can help! In advance, thank you!!
Menu that's giving me grief (ps. this is not done at all! I kinda stopped in the middle of it, because I am still trying to figure out this exception handling issue).
Settings class, just in case you would like to run the code