Changeset 17435 in josm for trunk


Ignore:
Timestamp:
2021-01-03T23:41:13+01:00 (2 months ago)
Author:
Don-vip
Message:

fix #20335 - NPE in changeset manager when sorting open changesets

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/dialogs/changeset/ChangesetCacheTableRowSorter.java

    r16826 r17435  
    22package org.openstreetmap.josm.gui.dialogs.changeset;
    33
    4 import java.util.Comparator;
     4import static java.util.Comparator.comparing;
     5import static java.util.Comparator.comparingInt;
     6import static java.util.Comparator.naturalOrder;
     7import static java.util.Comparator.nullsLast;
    58
    69import javax.swing.table.TableRowSorter;
     
    2023
    2124        // column 0 - Id
    22         setComparator(0, Comparator.comparingInt(Changeset::getId));
     25        setComparator(0, comparingInt(Changeset::getId));
    2326
    2427        // column 1 - Upload comment
    25         setComparator(1, Comparator.comparing(Changeset::getComment, AlphanumComparator.getInstance()));
     28        setComparator(1, comparing(Changeset::getComment, AlphanumComparator.getInstance()));
    2629
    2730        // column 2 - Open
    28         setComparator(2, Comparator.comparing(Changeset::isOpen));
     31        setComparator(2, comparing(Changeset::isOpen));
    2932
    3033        // column 3 - User
    31         setComparator(3, Comparator.comparing(Changeset::getUser, Comparator.comparing(User::getName)));
     34        setComparator(3, comparing(Changeset::getUser, comparing(User::getName)));
    3235
    3336        // column 4 - Created at
    34         setComparator(4, Comparator.comparing(Changeset::getCreatedAt));
     37        setComparator(4, comparing(Changeset::getCreatedAt));
    3538
    3639        // column 5 - Closed at
    37         setComparator(5, Comparator.comparing(Changeset::getClosedAt));
     40        setComparator(5, comparing(Changeset::getClosedAt, nullsLast(naturalOrder())));
    3841
    3942        // column 6 - Changes
    40         setComparator(6, Comparator.comparingInt(Changeset::getChangesCount));
     43        setComparator(6, comparingInt(Changeset::getChangesCount));
    4144
    4245        // column 7 - Discussions
    43         setComparator(7, Comparator.comparingInt(Changeset::getCommentsCount));
     46        setComparator(7, comparingInt(Changeset::getCommentsCount));
    4447    }
    4548}
Note: See TracChangeset for help on using the changeset viewer.