#Reading a CSV file with a Scanner

1 messages · Page 1 of 1 (latest)

rancid juniper
#

Was wondering what I can do to resolve the error I am having which is "finally block does not complete normally".

north stirrupBOT
#

<@&987246399047479336> please have a look, thanks.

north stirrupBOT
#

While you are waiting for getting help, here are some tips to improve your experience:

Code is much easier to read if posted with syntax highlighting and proper formatting.

If nobody is calling back, that usually means that your question was not well asked and hence nobody feels confident enough answering. Try to use your time to elaborate, provide details, context, more code, examples and maybe some screenshots. With enough info, someone knows the answer for sure.

Don't forget to close your thread using the command </help-thread close:1027500463647621170> when your question has been answered, thanks.

rancid juniper
#

When I run it I get a result like this

#

basically an error

cedar barn
#

also please use a try-with-resources

cedar barn
rancid juniper
#

I can't screenshot the entire thing or copy it but does this help?

#

Like I don't know if that really helps

#

I changed it up but I'm still producing the same result

rancid juniper
#

if you are referring to the csv file it is right here

mild agate
cedar barn
rancid juniper
#

I'm srry for being unclear but this is what I am trying to solve specifically the second part

cedar barn
#

if it can't find the file

#

you should throw, not catch

rancid juniper
#

is there a reason it is better to do it as a throw and is something like this in the right direction?

mild agate
#

If the file is not found, readTestResults won't be able to do anything about it

#

readTestResults can't recover from that problem. You should instead tell the person who specified the file that it was not found

#

You would only catch if

  1. You are able to recover from the issue
  2. You know 100% sure that the person calling the method won't be able to recover from the issue
rancid juniper
#

@mild agate and @cedar barn thank you for helping me. It makes more sense to me now. Sorry for being unclear with my question.

cedar barn
#

and can this method fail ? like if you call, it, will it be a bug if it throw a FileNotFoundException ?

mild agate
rancid juniper
#

I was able to yeah

mild agate
#

Awesome, good to hear. Gonna close this thread, to keep the number of active threads low. Can re-open at any time by posting again