Fix bug : Use try-with-resources or close this "ResultSet" in a "finally" clause (#1689)
* #1688 Fix bug : Use try-with-resources or close this "ResultSet" in a "finally" clause
* replace while to if where possible
* merge TaskRecordDao.java from dev