Details
-
Bug
-
Resolution: Fixed
-
Medium
-
2.8.1
-
None
-
None
Description
When a plugin attempts to send an email notification (when a smart commit fails, say), with certain email configurations, the following exception is thrown when the email notification is processed by FishEye:
java.lang.ClassCastException: com.cenqua.crucible.notification.Notification cannot be cast to java.lang.Comparable
at java.util.TreeMap.compare(Unknown Source)
at java.util.TreeMap.put(Unknown Source)
at java.util.TreeSet.add(Unknown Source)
at java.util.AbstractCollection.addAll(Unknown Source)
at java.util.TreeSet.addAll(Unknown Source)
at java.util.TreeSet.<init>(Unknown Source)
at com.cenqua.crucible.notification.batch.creators.PluginBatchCreator.getEmailSegment(PluginBatchCreator.java:50)
at com.cenqua.crucible.notification.DefaultNotificationManager.getBatchMessage(DefaultNotificationManager.java:556)
at com.cenqua.crucible.notification.DefaultNotificationManager.processNotification(DefaultNotificationManager.java:506)
at com.cenqua.crucible.notification.DefaultNotificationManager.processNotifications(DefaultNotificationManager.java:362)
at com.cenqua.crucible.notification.DefaultNotificationManager.access$200(DefaultNotificationManager.java:78)
at com.cenqua.crucible.notification.DefaultNotificationManager$6.run(DefaultNotificationManager.java:289)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask$Sync.innerRunAndReset(Unknown Source)
at java.util.concurrent.FutureTask.runAndReset(Unknown Source)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(Unknown Source)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
This is happening because we are adding a Notification object to a TreeSet. The contract for a TreeSet is:
All elements inserted into the set must implement the Comparable interface.
http://docs.oracle.com/javase/7/docs/api/java/util/TreeSet.html#TreeSet(java.util.SortedSet)