Project

General

Profile

Actions

bug #9356

closed

Comparison method violates its general contract for SourceComparator and TypeDesignationComparator

Added by Katja Luther over 3 years ago. Updated about 3 years ago.

Status:
Closed
Priority:
Highest
Assignee:
Category:
taxeditor
Target version:
Start date:
Due date:
% Done:

70%

Estimated time:
Severity:
normal
Found in Version:

Description

There are two comparators violating the contract: SourceComparator in taxeditor and typeDesignationComparator in cdmlib

last remote method : http://api.cybertaxonomy.org:80/casearia/remoting/common.service
last remote request client time : 2020-12-10T09:49:21.702
last remote request response header time : Thu, 10 Dec 2020 09:49:21 GMT
client error time : 2020-12-10T09:49:21.745
login : a.demestier
editor version : 5.18.0
server : api.cybertaxonomy.org (cybertaxonomy.org) / casearia
schema version : 5.18.6.0.20201124
os : Windows 7 6.1 amd64
java : 1.8.0_121
java.lang.IllegalArgumentException: Comparison method violates its general contract!
                at java.util.TimSort.mergeLo(TimSort.java:777)
                at java.util.TimSort.mergeAt(TimSort.java:514)
                at java.util.TimSort.mergeForceCollapse(TimSort.java:457)
                at java.util.TimSort.sort(TimSort.java:254)
                at java.util.Arrays.sort(Arrays.java:1512)
                at java.util.ArrayList.sort(ArrayList.java:1454)
                at java.util.Collections.sort(Collections.java:175)
                at eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection.renderContent(AbstractEntityCollectionSection.java:230)
                at eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection.expansionStateChanged(AbstractEntityCollectionSection.java:316)
                at org.eclipse.ui.forms.widgets.ExpandableComposite.fireExpanding(ExpandableComposite.java:1089)
                at org.eclipse.ui.forms.widgets.ExpandableComposite.toggleState(ExpandableComposite.java:1075)
                at org.eclipse.ui.forms.widgets.ExpandableComposite.access$5(ExpandableComposite.java:1071)
                at org.eclipse.ui.forms.widgets.ExpandableComposite$2.linkActivated(ExpandableComposite.java:569)
                at org.eclipse.ui.forms.widgets.AbstractHyperlink.handleActivate(AbstractHyperlink.java:228)
                at org.eclipse.ui.forms.widgets.AbstractHyperlink.handleMouseUp(AbstractHyperlink.java:322)
                at org.eclipse.ui.forms.widgets.AbstractHyperlink.access$2(AbstractHyperlink.java:306)
                at org.eclipse.ui.forms.widgets.AbstractHyperlink$4.handleEvent(AbstractHyperlink.java:129)
                at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
                at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4418)
                at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1079)
                at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4236)
                at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3824)
                at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$4.run(PartRenderingEngine.java:1121)
                at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336)
                at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1022)
                at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:150)
                at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:693)
                at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336)
                at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:610)
                at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:148)
                at eu.etaxonomy.taxeditor.Application.start(Application.java:20)
                at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
                at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
                at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
                at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:388)
                at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:243)
                at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
                at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
                at java.lang.reflect.Method.invoke(Method.java:498)
                at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:673)
                at org.eclipse.equinox.launcher.Main.basicRun(Main.java:610)
                at org.eclipse.equinox.launcher.Main.run(Main.java:1519)

Actions #1

Updated by Andreas Müller over 3 years ago

  • Status changed from New to In Progress
  • Target version changed from Unassigned CDM tickets to Release 5.19
Actions #2

Updated by Katja Luther over 3 years ago

  • Status changed from In Progress to Resolved
  • Assignee changed from Katja Luther to Andreas Müller
  • % Done changed from 0 to 50

adapted the comparator in cdmlib and removed hotfix workaround, please review.

Actions #3

Updated by Andreas Müller about 3 years ago

  • Status changed from Resolved to Feedback
  • Assignee changed from Andreas Müller to Katja Luther

For TypeDesignationComparator the line

return o1.getUuid().compareTo(o2.getUuid());

will never be reached as if any of the type status are null 1 or -1 is returned before.

I adapted the code to make the different cases clearer.

Can you please review the code?

It would be good to have tests on such tests so these errors can be found easily.

Actions #4

Updated by Andreas Müller about 3 years ago

  • % Done changed from 50 to 70

The SourceComparator looks fine. I only cleaned it up a bit.

Actions #5

Updated by Katja Luther about 3 years ago

  • Status changed from Feedback to Closed

Andreas Müller wrote:

For TypeDesignationComparator the line

return o1.getUuid().compareTo(o2.getUuid());

will never be reached as if any of the type status are null 1 or -1 is returned before.

I adapted the code to make the different cases clearer.

Can you please review the code?

It would be good to have tests on such tests so these errors can be found easily.

looks fine

Actions

Also available in: Atom PDF