0

I have a program that reads lines from csv file. I want to get number of errors (number of all corrupted columns). The program works as:

For each line : try { checkColumn1 method () --> May Throw myException checkColumn2 method () --> May Throw myException checkColumn3 method () --> May Throw myException .... .... checkLastColumnCSV method () --> May Throw myException }catch (myException object){ countErrors ++; } 

My program stops at the first exception thrown by a check method, but I want the program to continue executing until the last Checkcolumn method in order to calculate the number of errors on all columns.

I'm working with Java 6 (in an old project), so I cannot use the functional interface.

Thank you for your suggestions.

3
  • 1
    Does this answer your question? How can I continue executing code after a try/catch block catches an exception? Commented Feb 9, 2021 at 16:41
  • Thank you Yes I'm working with JAVA 6 (in an old project) So I cannot use the Functionnal Interface Commented Feb 9, 2021 at 17:01
  • is method() always the same method? Commented Feb 9, 2021 at 17:27

1 Answer 1

1

Surround each call to checkColumnx with a try - catch block.

Sign up to request clarification or add additional context in comments.

1 Comment

do you think this is the only solution we can have? I have several methods, is there a way treat the whole block

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.