Error loading BPMN into flowable-modeler ui

Just throwing this out there… not sure what’s the cause but when I import a specific file, I get the following error message:

Error while processing the BPMN XML file : Import failed for fileName.bpmn, error message Comparison method violates its general contract!

Not sure what this means but I’ve got an end event and sequence that if I remove, the file loads fine… then I use the editor to generate the exact same piece of logic and save, download the bpmn and upload it… also fine.

The error message Comparison method violates its general contract is an exception from Java’s comparator interface, it happens when a comparitor is not internally consistent (a < b < c < a) are you able to share a bpmn file that throws the exception?

I wouldn’t be able to share the exact BPMN but maybe I’ll be able to prepare something for you later this week for further examination.

So I’ve managed to narrow this down a bit further (unfortunately I can’t seem to assemble a test XML to duplicate the problem.

I’m creating a converter to port business rules from one system in another diagram format to another and just last week I started to use the BPMNAutoLayout class to create a cleaner look for the diagrams that I’ve been creating and I’ve run into this stack trace on some of the diagrams…

I thought I’d bounce the exception off of you and see if you could tell me anything about it since it’s very similar to the one I was getting when attempting to load the diagram into the editor.

Here it is:

java.lang.IllegalArgumentException: Comparison method violates its general contract!
	at java.util.ComparableTimSort.mergeLo(ComparableTimSort.java:744)
	at java.util.ComparableTimSort.mergeAt(ComparableTimSort.java:481)
	at java.util.ComparableTimSort.mergeForceCollapse(ComparableTimSort.java:422)
	at java.util.ComparableTimSort.sort(ComparableTimSort.java:222)
	at java.util.Arrays.sort(Arrays.java:1246)
	at com.mxgraph.layout.hierarchical.stage.mxCoordinateAssignment.rankMedianPosition(mxCoordinateAssignment.java:588)
	at com.mxgraph.layout.hierarchical.stage.mxCoordinateAssignment.medianPos(mxCoordinateAssignment.java:534)
	at com.mxgraph.layout.hierarchical.stage.mxCoordinateAssignment.execute(mxCoordinateAssignment.java:275)
	at com.mxgraph.layout.hierarchical.mxHierarchicalLayout.placementStage(mxHierarchicalLayout.java:549)
	at com.mxgraph.layout.hierarchical.mxHierarchicalLayout.run(mxHierarchicalLayout.java:393)
	at com.mxgraph.layout.hierarchical.mxHierarchicalLayout.execute(mxHierarchicalLayout.java:202)
	at com.mxgraph.layout.hierarchical.mxHierarchicalLayout.execute(mxHierarchicalLayout.java:159)
	at org.flowable.bpmn.BpmnAutoLayout.layout(BpmnAutoLayout.java:169)
	at org.flowable.bpmn.BpmnAutoLayout.execute(BpmnAutoLayout.java:99)
	at levisj.tests.ConvertSDL.processFile(ConvertSDL.java:295)
	at levisj.tests.ConvertSDL.test(ConvertSDL.java:49)
	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.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:89)
	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:41)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:541)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:763)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:463)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:209)
``

It does seem to be related to a wrong Comparator being used in one of the mxGraph classes. Hard to say more without an example bpmn that throws this exception.