nus-cs2113-AY2324S1 / forum

0 stars 0 forks source link

Test IP jar file for Mac or Linux #27

Closed StanleyW00 closed 1 year ago

StanleyW00 commented 1 year ago

Hello, I have an issue regarding getting input for Mac and Linux for my project and I have modified my code.I have used Windows and I am wondering if anyone willing do a smoke test with my project to see if there's still a problem regarding inputting.

https://github.com/StanleyW00/ip

skylee03 commented 1 year ago

I don't know what your input issue is, but I just tested your program on Linux. I tried adding some tasks and restarting your program, and the files can be loaded normally.

skylee03 commented 1 year ago

image

StanleyW00 commented 1 year ago

Thanks for testing my program! Regarding the problem, I was informed that my program has java.util.NoSuchElementException error for Mac and Linux. I noticed that the line that was referred to is where I tried to trim while calling the nextline method during inputting.

At least, I know that my program works on Linux.

skylee03 commented 1 year ago

I think this exception is actually thrown by nextLine(). This problem occurs if the input stream has no new content but you still try to read from it. I'm not sure in what situation you encountered this problem, but at least I reproduced this problem in two cases:

  1. Reads commands from a file, which does not contain bye.
  2. Type Ctrl + D (or Ctrl + Z on Windows) at the command line to send an EOF character.

Generally, you don't need to worry about the above two special situations. If you really want to deal with this problem, you can use hasNextLine() to check whether the scanner has next line.

skylee03 commented 1 year ago

image

StanleyW00 commented 1 year ago

I have added the part where it checks using hasNextLine(). See if it is fixes the problem that you mentioned.