java.lang.ClassCastException: com.cenqua.crucible.notification.Notification cannot be cast to java.lang.Comparable

Atlassian JIRA | Nick Pellow [Atlassian] | 4 years ago
  1. 0

    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: {code} 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) {code} This is happening because we are adding a Notification object to a TreeSet. The contract for a TreeSet is: bq. 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)

    Atlassian JIRA | 4 years ago | Nick Pellow [Atlassian]
    java.lang.ClassCastException: com.cenqua.crucible.notification.Notification cannot be cast to java.lang.Comparable
  2. 0

    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: {code} 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) {code} This is happening because we are adding a Notification object to a TreeSet. The contract for a TreeSet is: bq. 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)

    Atlassian JIRA | 4 years ago | Nick Pellow [Atlassian]
    java.lang.ClassCastException: com.cenqua.crucible.notification.Notification cannot be cast to java.lang.Comparable
  3. 0

    NavigableSet can't add different sub class

    Stack Overflow | 2 years ago
    java.lang.ClassCastException: com.simon.main.AModel cannot be cast to java.lang.Comparable
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Map + Set

    Google Groups | 1 decade ago | Sted Alana
    java.lang.ClassCastException: java.util.HashMap$Entry
  6. 0

    can't convert hashset to treeset with object collection

    Stack Overflow | 1 year ago | boblinux
    java.lang.ClassCastException: fr.univtln.arouani277.vertebre.animal.Chien cannot be cast to java.lang.Comparable

    2 unregistered visitors
    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.lang.ClassCastException

      com.cenqua.crucible.notification.Notification cannot be cast to java.lang.Comparable

      at java.util.TreeMap.compare()
    2. Java RT
      TreeSet.<init>
      1. java.util.TreeMap.compare(Unknown Source)
      2. java.util.TreeMap.put(Unknown Source)
      3. java.util.TreeSet.add(Unknown Source)
      4. java.util.AbstractCollection.addAll(Unknown Source)
      5. java.util.TreeSet.addAll(Unknown Source)
      6. java.util.TreeSet.<init>(Unknown Source)
      6 frames
    3. com.cenqua.crucible
      DefaultNotificationManager$6.run
      1. com.cenqua.crucible.notification.batch.creators.PluginBatchCreator.getEmailSegment(PluginBatchCreator.java:50)
      2. com.cenqua.crucible.notification.DefaultNotificationManager.getBatchMessage(DefaultNotificationManager.java:556)
      3. com.cenqua.crucible.notification.DefaultNotificationManager.processNotification(DefaultNotificationManager.java:506)
      4. com.cenqua.crucible.notification.DefaultNotificationManager.processNotifications(DefaultNotificationManager.java:362)
      5. com.cenqua.crucible.notification.DefaultNotificationManager.access$200(DefaultNotificationManager.java:78)
      6. com.cenqua.crucible.notification.DefaultNotificationManager$6.run(DefaultNotificationManager.java:289)
      6 frames
    4. Java RT
      ThreadPoolExecutor$Worker.run
      1. java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
      2. java.util.concurrent.FutureTask$Sync.innerRunAndReset(Unknown Source)
      3. java.util.concurrent.FutureTask.runAndReset(Unknown Source)
      4. java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(Unknown Source)
      5. java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)
      6. java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
      7. java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
      7 frames