Modify

Opened 4 weeks ago

Closed 3 weeks ago

#20335 closed defect (fixed)

[PATCH] NPE in changeset manager

Reported by: Olivier <nive@…> Owned by: team
Priority: normal Milestone: 21.01
Component: Core Version: latest
Keywords: changeset manager sort date Cc:

Description

If the list of changeset contains any opened changeset, then sorting by closing date cause a NullPointerException.

Revision:17429

=== REPORTED CRASH DATA ===
BugReportExceptionHandler#handleException:
No data collected.

Warning issued by: BugReportExceptionHandler#handleException

=== STACK TRACE ===
Thread: AWT-EventQueue-0 (21) of main
java.lang.NullPointerException
	at java.base/java.util.Date.getMillisOf(Date.java:956)
	at java.base/java.util.Date.compareTo(Date.java:979)
	at java.base/java.util.Date.compareTo(Date.java:133)
	at java.base/java.util.Comparator.lambda$comparing$77a9974f$1(Comparator.java:469)
	at java.desktop/javax.swing.DefaultRowSorter.compare(DefaultRowSorter.java:981)
	at java.desktop/javax.swing.DefaultRowSorter$Row.compareTo(DefaultRowSorter.java:1391)
	at java.desktop/javax.swing.DefaultRowSorter$Row.compareTo(DefaultRowSorter.java:1381)
	at java.base/java.util.ComparableTimSort.countRunAndMakeAscending(ComparableTimSort.java:320)
	at java.base/java.util.ComparableTimSort.sort(ComparableTimSort.java:202)
	at java.base/java.util.Arrays.sort(Arrays.java:1249)
	at java.desktop/javax.swing.DefaultRowSorter.sortExistingData(DefaultRowSorter.java:562)
	at java.desktop/javax.swing.DefaultRowSorter.setSortKeys(DefaultRowSorter.java:317)
	at java.desktop/javax.swing.DefaultRowSorter.toggleSortOrder(DefaultRowSorter.java:476)
	at java.desktop/javax.swing.plaf.basic.BasicTableHeaderUI$MouseInputHandler.mouseClicked(BasicTableHeaderUI.java:120)
	at java.desktop/java.awt.AWTEventMulticaster.mouseClicked(AWTEventMulticaster.java:278)
	at java.desktop/java.awt.Component.processMouseEvent(Component.java:6638)
	at java.desktop/javax.swing.JComponent.processMouseEvent(JComponent.java:3342)
	at java.desktop/java.awt.Component.processEvent(Component.java:6400)
	at java.desktop/java.awt.Container.processEvent(Container.java:2263)
	at java.desktop/java.awt.Component.dispatchEventImpl(Component.java:5011)
	at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2321)
	at java.desktop/java.awt.Component.dispatchEvent(Component.java:4843)
	at java.desktop/java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4918)
	at java.desktop/java.awt.LightweightDispatcher.processMouseEvent(Container.java:4556)
	at java.desktop/java.awt.LightweightDispatcher.dispatchEvent(Container.java:4488)
	at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2307)
	at java.desktop/java.awt.Window.dispatchEventImpl(Window.java:2772)
	at java.desktop/java.awt.Component.dispatchEvent(Component.java:4843)
	at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:772)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:715)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:95)
	at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:745)
	at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:743)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
	at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:742)
	at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
	at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)

Tested patch:

  • src/org/openstreetmap/josm/gui/dialogs/changeset/ChangesetCacheTableRowSorter.java

    diff --git a/src/org/openstreetmap/josm/gui/dialogs/changeset/ChangesetCacheTableRowSorter.java b/src/org/openstreetmap/josm/gui/dialogs/changeset/ChangesetCacheTableRowSorter.java
    index ab37dfdce..26980b577 100644
    a b  
    22package org.openstreetmap.josm.gui.dialogs.changeset;
    33
    44import java.util.Comparator;
     5import java.util.Date;
    56
    67import javax.swing.table.TableRowSorter;
    78
    class ChangesetCacheTableRowSorter extends TableRowSorter<ChangesetCacheManagerM 
    3435        setComparator(4, Comparator.comparing(Changeset::getCreatedAt));
    3536
    3637        // column 5 - Closed at
    37         setComparator(5, Comparator.comparing(Changeset::getClosedAt));
     38        setComparator(5, Comparator.comparing((Changeset c) -> c.getClosedAt() != null ? c.getClosedAt() : new Date()));
    3839
    3940        // column 6 - Changes
    4041        setComparator(6, Comparator.comparingInt(Changeset::getChangesCount));

Attachments (0)

Change History (5)

comment:1 Changed 4 weeks ago by skyper

Keywords: changeset manager sort date added

comment:2 Changed 4 weeks ago by skyper

Maybe related to #20165.

comment:3 Changed 3 weeks ago by Don-vip

Milestone: 21.01
Summary: NPE in changeset manager[PATCH] NPE in changeset manager

comment:4 Changed 3 weeks ago by Don-vip

Priority: trivialnormal

comment:5 Changed 3 weeks ago by Don-vip

Resolution: fixed
Status: newclosed

In 17435/josm:

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

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain team.
as The resolution will be set.
The resolution will be deleted.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.