Most likely that one of the instructions in the "else" section is throwing an exception thus the system exits the loop and the entire method.

If you are using an IDE you should use trancing tools, otherwise make use of the Exception instance to figure out whats going wrong