Uploaded image for project: 'FishEye'
  1. FishEye
  2. FE-4266

Email Notifications fired from plugins fail with: java.lang.ClassCastException: com.cenqua.crucible.notification.Notification cannot be cast to java.lang.Comparable

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Medium
    • 2.8.2
    • 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)

      Attachments

        Activity

          People

            npellow Nick
            npellow Nick
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - Not Specified
                Not Specified
                Logged:
                Time Spent - 7m
                7m