I made the changes and removed the parser from the statement where the method returns the value but it is still giving the same error for the one parser in the setDate method
There is small mistake in the code that Mai has pointed out, you need to call parse not format. However this does not seem to be related to the null issue.