Timestamp t1 = i1.getInserted(); Timestamp t2 = i2.getInserted();
Timestamp t1, t2; try { t1 = i1.getInserted(); } catch (Exception e) { t1 = null; } try { t2 = i2.getInserted(); } catch (Exception e) { t2 = null; }
    private List sort(List nodes, final boolean ascending)    {        Comparator c;        switch (sortType) {            case Browser.SORT_NODES_BY_DATE:                c = new Comparator() {                    public int compare(Object o1, Object o2)                    {                        ImageData i1 = (ImageData)                                       (((TreeImageDisplay) o1).getUserObject());                        ImageData i2 = (ImageData)                                     (((TreeImageDisplay) o2).getUserObject());                        Timestamp t1 = i1.getInserted();                        Timestamp t2 = i2.getInserted();                        if (t1 == null)                            t1 = TreeViewerTranslator.getDefaultTimestamp();                        if (t2 == null)                            t2 = TreeViewerTranslator.getDefaultTimestamp();                        int r = t1.compareTo(t2);                        int v = 0;                        if (r < 0) v = -1;                        else if (r > 0) v = 1;                        if (ascending) return v;                        return -v;                    }                };                break;            case Browser.SORT_NODES_BY_NAME:            default:                c = new Comparator() {                    public int compare(Object o1, Object o2)                    {                        String s1 = o1.toString().toLowerCase();                        String s2 = o2.toString().toLowerCase();                        int result = s1.compareTo(s2);                        int v = 0;                        if (result < 0) v = -1;                        else if (result > 0) v = 1;                        if (ascending) return v;                        return -v;                    }                };        }        Collections.sort(nodes, c);        return nodes;    }