Issue 17542

File sorting is broken

17542
Reporter: trobertson
Assignee: trobertson
Type: Feedback
Summary: File sorting is broken
Priority: Blocker
Resolution: CantReproduce
Status: Closed
Created: 2015-04-09 13:49:49.025
Updated: 2018-05-31 16:19:42.654
Resolved: 2018-05-31 16:19:42.51
        
Description: The following stack trace reported by an IPT user on windows provides the information needed.

This provides the reasoning
http://stackoverflow.com/questions/22302500/sorting-throws-java-lang-illegalargumentexception-comparison-method-violates-it

{code}
Validating the core record ID http://rs.tdwg.org/dwc/terms/occurrenceID is always present and unique. Depending on the number of records, this can take a while.
Archive generation failed!
java.lang.IllegalArgumentException: Comparison method violates its general contract!
        at java.util.TimSort.mergeLo(Unknown Source)
        at java.util.TimSort.mergeAt(Unknown Source)
        at java.util.TimSort.mergeCollapse(Unknown Source)
        at java.util.TimSort.sort(Unknown Source)
        at java.util.Arrays.sort(Unknown Source)
        at java.util.Collections.sort(Unknown Source)
        at org.gbif.utils.file.FileUtils.sortAndWrite(FileUtils.java:793)
        at org.gbif.utils.file.FileUtils.sortInJava(FileUtils.java:634)
        at org.gbif.utils.file.FileUtils.sort(FileUtils.java:592)
        at org.gbif.ipt.task.GenerateDwca.sortCoreDataFile(GenerateDwca.java:358)
        at org.gbif.ipt.task.GenerateDwca.validateCoreDataFile(GenerateDwca.java:386)
        at org.gbif.ipt.task.GenerateDwca.validate(GenerateDwca.java:324)
        at org.gbif.ipt.task.GenerateDwca.call(GenerateDwca.java:544)
        at org.gbif.ipt.task.GenerateDwca.call(GenerateDwca.java:51)
        at java.util.concurrent.FutureTask.run(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
        at java.lang.Thread.run(Unknown Source)
{code}]]>
    


Author: kbraak@gbif.org
Created: 2015-04-10 11:16:51.465
Updated: 2015-04-10 11:16:51.465
        
The reporter of this issue was running his IPT on a server with the following specifications:

OS Version:                   Windows Server 2012 Datacenter Edition (64 bit)
Java version:                 1.8.0_20
    


Author: mblissett
Comment: I haven't seen this in my testing on Windows, we are probably using different routines now with other changes I made.
Created: 2018-05-31 16:19:42.575
Updated: 2018-05-31 16:19:42.575