Collections.sort(openMilestones, new Comparator<TicketMilestone>() {\r
@Override\r
public int compare(TicketMilestone o1, TicketMilestone o2) {\r
- return o2.due.compareTo(o1.due);\r
+ if (o1.due == null) {\r
+ return (o2.due == null) ? 0 : 1;\r
+ } else if (o2.due == null) {\r
+ return -1;\r
+ } else {\r
+ return o1.due.compareTo(o2.due);\r
+ }\r
}\r
});\r
\r
Collections.sort(closedMilestones, new Comparator<TicketMilestone>() {\r
@Override\r
public int compare(TicketMilestone o1, TicketMilestone o2) {\r
- return o2.due.compareTo(o1.due);\r
+ if (o1.due == null) {\r
+ return (o2.due == null) ? 0 : 1;\r
+ } else if (o2.due == null) {\r
+ return -1;\r
+ } else {\r
+ return o1.due.compareTo(o2.due);\r
+ }\r
}\r
});\r
\r