Quote:
what is the mistake in my above code.
Start by writing out 100 times: "I must not swallow exceptions".
Empty
catch
blocks don't fix problems - they hide them for later, and discard the very information you need to fix them. LOg the error, the error message, any inner exception, the whole nine yards. Then after the problem occurs you can look at the log and get some idea of why it happened.
But swallowing the exception means you don't get that, and have no idea what actually caused the problem ... and neither do we.