private Date convertToDate ( String dateInString ) throws IOException { Date date = null ; if ( dateInString != null ) { try { date = LibraryUtils . getUtcSdf ( ) . parse ( dateInString ) ; } catch ( ParseException e ) { throw new IOException ( "Cannot parse " + dateInString + " as Date" , e ) ; } } return date ; }
This method convert a String to Date type . When parse error happened return current date .