cancel
Showing results for 
Search instead for 
Did you mean: 

Exception in Crystal Reports when using Java 7 and TimSort

Former Member
0 Kudos

Hi

We have encountered an error when using the Java export functionality of Crystal Reports. This error occurs using the latest runtime available for download (crjava-runtime_12.2.219).

The error only occurs when using JRE that implements sorting via TimSort (i.e. JRE version 7 and higher). The stack trace is as follows:

com.crystaldecisions.sdk.occa.report.lib.ReportSDKException: Comparison method violates its general contract!---- Error code:-2147467259 Error code name:

Caused by: java.lang.IllegalArgumentException: Comparison method violates its general contract!

at java.util.TimSort.mergeHi(TimSort.java:895)

at java.util.TimSort.mergeAt(TimSort.java:512)

at java.util.TimSort.mergeForceCollapse(TimSort.java:453)

at java.util.TimSort.sort(TimSort.java:250)

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 com.crystaldecisions.reports.formatter.formatter.lightmodel.cellmodel.FCMCellModel.a(SourceFile:1234)

at com.crystaldecisions.reports.formatter.formatter.lightmodel.cellmodel.FCMCellModel.if(SourceFile:498)

at com.crystaldecisions.reports.formatter.formatter.lightmodel.cellmodel.FCMCellModel.<init>(SourceFile:245)

at com.crystaldecisions.reports.formatter.formatter.lightmodel.FCMFormattedContentModeller.getCellModel(SourceFile:157)

at com.crystaldecisions.reports.exporters.excel.Excel97Exporter.processFormattedContent(SourceFile:206)

at com.crystaldecisions.reports.formatter.export2.a.a(SourceFile:104)

at com.crystaldecisions.reports.formatter.export2.a.a(SourceFile:247)

at com.crystaldecisions.reports.formatter.export2.ExportSupervisorEx.if(SourceFile:642)

at com.crystaldecisions.reports.formatter.export2.ExportSupervisorEx.a(SourceFile:586)

at com.businessobjects.reports.sdk.requesthandler.ReportViewingRequestHandler.a(SourceFile:636)

at com.businessobjects.reports.sdk.requesthandler.ReportViewingRequestHandler.int(SourceFile:672)

at com.businessobjects.reports.sdk.JRCCommunicationAdapter.do(SourceFile:1943)

at com.businessobjects.reports.sdk.JRCCommunicationAdapter.if(SourceFile:660)

at com.businessobjects.reports.sdk.JRCCommunicationAdapter.a(SourceFile:166)

at com.businessobjects.reports.sdk.JRCCommunicationAdapter$2.a(SourceFile:528)

at com.businessobjects.reports.sdk.JRCCommunicationAdapter$2.call(SourceFile:526)

at com.crystaldecisions.reports.common.ThreadGuard.syncExecute(SourceFile:102)

at com.businessobjects.reports.sdk.JRCCommunicationAdapter.for(SourceFile:524)

at com.businessobjects.reports.sdk.JRCCommunicationAdapter.int(SourceFile:423)

at com.businessobjects.reports.sdk.JRCCommunicationAdapter.request(SourceFile:351)

at com.businessobjects.sdk.erom.jrc.a.a(SourceFile:54)

at com.businessobjects.sdk.erom.jrc.a.execute(SourceFile:67)

at com.crystaldecisions.proxy.remoteagent.RemoteAgent$a.execute(SourceFile:716)

at com.crystaldecisions.proxy.remoteagent.CommunicationChannel.a(SourceFile:125)

at com.crystaldecisions.proxy.remoteagent.RemoteAgent.a(SourceFile:537)

at com.crystaldecisions.sdk.occa.report.application.ds.a(SourceFile:186)

at com.crystaldecisions.sdk.occa.report.application.ReportSource.a(SourceFile:1558)

at com.crystaldecisions.sdk.occa.report.application.ReportSource.a(

This error does not occur when TimSort is disabled via the system property -Djava.util.Arrays.useLegacyMergeSort=true.

The issue is probably caused by a bug in the Crystal Reports engine where the comparator used at "com.crystaldecisions.reports.formatter.formatter.lightmodel.cellmodel.FCMCellModel.a(SourceFile:1234)" is not implemented correctly. We have seen this exception occur when a comparator does not return 0 when comparing two equal objects. This leads to the impossible scenario that a < b and b < a for two equal objects a and b. This bug is exposed by the TimSort algorithm that was introduced in Java 7. The comparator which may be causing the issue is com.crystaldecisions.reports.formatter.formatter.lightmodel.cellmodel.CMCellObject.LessCompComparator.

Is this a bug and is it likely to be fixed in a future release of the Crystal Reports Java runtime?

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Jonathan,

This is the developer from SAP.

Cloud you help to provide a sample code and sample report. In this way, we can reproduce the issue in-house?

From the callstack, you are right it is known issue in Java 7 as following:

http://www.oracle.com/technetwork/java/javase/compatibility-417013.html#source

Synopsis: Updated sort behavior for Arrays and Collections may throw an IllegalArgumentException

So we just recommand you to use the workaround firstly.

Use the the system propertly java.util.Arrays.use.LegacyMergeSort.

And we get the sample code and report. We can do the further investigation.

Thanks.

Yunfeng Chen

Former Member
0 Kudos

Hi Yunfeng

Thanks very much for having a look at this.

The data where we see this occur is unfortunately sensitive customer data and I cannot share it. I will spend some time tomorrow (Wednesday) to attempt to reproduce the issue with a simple report. Will let you know as soon as I have it.

Regards

Jonathan

Former Member
0 Kudos

Hi Yunfeng

I have not been able to reproduce the issue on its own. It only occurs when we run using customer data, which I cannot share.

Will you be able to proceed with the investigation of this issue without this information?

Regards

Jonathan

former_member183750
Active Contributor
0 Kudos

Hi Jonathan

Got a reply from Product Management. Essentially it boils down to:

“we have plan to support Weblogic 12 in future release”.

Now this is not as bad as it may appear at first blush as this means that there is a future release planned. E.g.; we removed the "if" and only the "when" remains...

- Ludek

Former Member
0 Kudos

Hi Ludek

Thank you for the response and the support thus far.

Can you please clarify one last thing? What is meant by "support Weblogic 12 in future release"? Does this imply that a future release of the "Crystal Reports, Version For Eclipse" product (specifically Crystal Reports for Java runtime components - Java Reporting Component) will have a fix for this issue?

Regards

Jonathan

former_member183750
Active Contributor
0 Kudos

Yea, that is how I would interpret this.

Now, understanding that this is a free product. There are dozens of other SAP products under development. There is a limited pool of developers. The time line is - well, cal it undefined...

Apologies for being so vague, just laying the cards on the table - face up.

- Ludek

Former Member
0 Kudos

OK, thanks for the confirmation and thanks for your help!

Answers (1)

Answers (1)

former_member183750
Active Contributor
0 Kudos

This looks like a bug. I've alerted R&D and they will be looking into the issue.

- Ludek

Senior Support Engineer AGS Product Support, Global Support Center Canada

Follow me on Twitter

Got Enhancement ideas? Use the SAP Idea Place