Controller Hang whenever execute both functions(Parsing File and Writing File)

Is this is due to bug OR our mistake logically.

Get rid of EVERY SINGLE instance of the String class in your code. Then, if it still has a problem, we'll talk.