如何使用这个堆栈跟踪在Java中调试,而没有提到我自己的类?

前端之家收集整理的这篇文章主要介绍了如何使用这个堆栈跟踪在Java中调试,而没有提到我自己的类?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

这是困难的一个.客户通过崩溃报告向我发送了此堆栈跟踪信息.它没有提到我的应用程序的类,所以我很困惑,从哪里开始寻找.

我的应用是商业桌面应用.崩溃报告是匿名的,因此我无法轻易获得有关崩溃的更多信息.

编辑:一些谷歌搜索和线程跟踪使我得出结论,它是Java 1.7中的零星问题.寻找解决方案……

我该如何进行调试呢?

java.lang.IllegalArgumentException: Comparison method violates its general contract!
        at java.util.TimSort.mergeHi(TimSort.java:868)
        at java.util.TimSort.mergeAt(TimSort.java:485)
        at java.util.TimSort.mergeCollapse(TimSort.java:410)
        at java.util.TimSort.sort(TimSort.java:214)
        at java.util.TimSort.sort(TimSort.java:173)
        at java.util.Arrays.sort(Arrays.java:659)
        at java.util.Collections.sort(Collections.java:217)
        at javax.swing.SortingFocusTraversalPolicy.enumerateAndSortCycle(SortingFocusTraversalPolicy.java:136)
        at javax.swing.SortingFocusTraversalPolicy.getFocusTraversalCycle(SortingFocusTraversalPolicy.java:110)
        at javax.swing.SortingFocusTraversalPolicy.getFirstComponent(SortingFocusTraversalPolicy.java:435)
        at javax.swing.LayoutFocusTraversalPolicy.getFirstComponent(LayoutFocusTraversalPolicy.java:166)
        at javax.swing.DefaultFocusManager.getFirstComponent(DefaultFocusManager.java:120)
        at javax.swing.LegacyGlueFocusTraversalPolicy.getFirstComponent(LegacyGlueFocusTraversalPolicy.java:132)
        at javax.swing.LegacyGlueFocusTraversalPolicy.getDefaultComponent(LegacyGlueFocusTraversalPolicy.java:150)
        at java.awt.FocusTraversalPolicy.getInitialComponent(FocusTraversalPolicy.java:169)
        at java.awt.DefaultKeyboardFocusManager.dispatchEvent(DefaultKeyboardFocusManager.java:380)
        at java.awt.Component.dispatchEventImpl(Component.java:4731)
        at java.awt.Container.dispatchEventImpl(Container.java:2287)
        at java.awt.Window.dispatchEventImpl(Window.java:2719)
        at java.awt.Component.dispatchEvent(Component.java:4687)
        at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:723)
        at java.awt.EventQueue.access$200(EventQueue.java:103)
        at java.awt.EventQueue$3.run(EventQueue.java:682)
        at java.awt.EventQueue$3.run(EventQueue.java:680)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
        at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:87)
        at java.awt.EventQueue$4.run(EventQueue.java:696)
        at java.awt.EventQueue$4.run(EventQueue.java:694)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:693)
        at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242)
        at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)
        at java.awt.EventDispatchThread.run(EventDispatchThread.java:91)
最佳答案
正如其他地方所指出的那样,正在排序的集合中的项目(可能包括或不包括您自己的类,无法从堆栈跟踪中判断出来)违反了比较合同.

在从Java 6转换到Java 7期间,默认排序实现更改为TimSort.其中一个影响是新排序对比较合同更严格,因此您(或许可能是Swing)可能已经离开用了很长时间,但不再.

如果您无法通过比较合同解决问题,则可以通过使用属性启动应用程序来回滚以使用Java 6样式排序

-Djava.util.Arrays.useLegacyMergeSort=true

详见Java 7发行说明,compatibility section.

原文链接:https://www.f2er.com/java/438301.html

猜你在找的Java相关文章