Fixed Parser.java with more fault-tolerant exception management