I suspect your problem is in this piece of code
for(int wrk_len= 0;wrk_len<wrk.size();wrk_len++)
{
String str = list.get(wrk_len).toString();
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
Date date = df.parse(str);
l.add(date);
}
your for loop is limited by the ArrayList wrk:
wrk_len<wrk.size()
but the code inside the loop works on the ArrayList list:
String str = list.get(wrk_len).toString();
I think either the test in the loop is wrong or the ArrayList you are operating on is wrong