Menu

#120 NTranscriptionView incompatible with new Java version

closed
nobody
None
5
2012-10-19
2012-10-18
No

Use of TreeSet in NTranscriptionView where the comparator is not defined causes a ClassCastError. That's because if the comparator is not defined, TreeSet assumes the elements you add will implement Comparable, but gui.transcriptionviewer.DefaultTransToAnnoMap does not. As far as I can see in those cases we could be using HashSet (and on a very quick test it looks OK and fixed the bug), but it needs more work to confirm. This has only manifested on Win7 systems, but I don't think that's the issue. Here's the exception:

java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at net.sourceforge.nite.nxt.GUI$RunProg.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ClassCastException:
net.sourceforge.nite.gui.transcriptionviewer.DefaultTransToAnnoMap cannot be cast to java.lang.Comparable
at java.util.TreeMap.compare(Unknown Source)
at java.util.TreeSet.add(Unknown Source)
at net.sourceforge.nite.gui.transcriptionviewer.NTranscriptionView.<init>(Unknown Source)
at net.sourceforge.nite.gui.util.AbstractCallableTool.setupTranscriptionView(Unknown Source)

Discussion

  • Jonathan Kilgour

    I made all the TreeSets without Comparators into HashSetsm did a bit of testing and consulted with Dennis. Looks OK..

     
  • Jonathan Kilgour

    • status: open --> closed