Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Not A Problem
-
2.3.3
-
None
-
None
-
Ubuntu linux 12.04.
Java version: 1.7.0_03, vendor: Oracle Corporation
Description
With JDK 7 the single sitegraph unit test fails to run. Unsure if this affects deployments as different view implementations are used.
Test set: org.apache.struts2.sitegraph.SiteGraphTest
-------------------------------------------------------------------------------
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.757 sec <<< FAILURE!
testWebFlow(org.apache.struts2.sitegraph.SiteGraphTest) Time elapsed: 0.743 sec <<< ERROR!
java.lang.ClassCastException: org.apache.struts2.sitegraph.entities.Target cannot be cast to java.lang.Comparable
at java.util.TreeMap.compare(TreeMap.java:1188)
at java.util.TreeMap.put(TreeMap.java:531)
at java.util.TreeSet.add(TreeSet.java:255)
at org.apache.struts2.sitegraph.entities.FileBasedView.matchPatterns(FileBasedView.java:79)
at org.apache.struts2.sitegraph.entities.FileBasedView.getTargets(FileBasedView.java:62)
at org.apache.struts2.sitegraph.renderers.DOTRenderer.render(DOTRenderer.java:137)
at org.apache.struts2.sitegraph.SiteGraph.prepare(SiteGraph.java:122)
at org.apache.struts2.sitegraph.SiteGraphTest.testWebFlow(SiteGraphTest.java:46)
Possible solutions:
Let entities.Target implement Comparable.
Use HashSet instead of TreeSet in FileBasedView.java:53 (with possible performance losses)
Provide a Comparator to the TreeSet in FileBasedView.java:53