I am testing a vendor program like the above program, and do not know why exception is throw before "status 3" and after "status 1". Do someone know why exception will throw between status 1 and status 3? It is a runtime exception.
Are we supposed to guess what exception is thrown? Is there any other code besides what you posted here?
Please be as precise as possible when you ask a question. Include the complete code and copy & paste the error message (including stacktrace) into your post. The more precise you are, the quicker and better we can help you to solve the problem.
Right now you're not providing us with enough information and it's impossible to say anything useful about it.