Uploaded image for project: 'Jira Data Center'
  1. Jira Data Center
  2. JRASERVER-10434

ClassCastException in com/atlassian/jira/issue/comparator/IssueKeyComparator

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Medium
    • 3.6.3
    • 3.6.1
    • Issue - Actions
    • tomcat 4.1.30, MS SQL 2K, fedora core 1

    Description

      We upgraded to 3.6.1 recently and now we are having problems when creating links to issues. I have checked all the permissions, they are all good. I can create a link to an issue, it will show up in the issue where I created it from as long as there is no other links there. As soon as I get more than one link, the links and attachments are no longer visible.

      This is the error in the log:

      SEVERE: METHOD: "showIssueDetails", exception:
      java.lang.ClassCastException
      at com.atlassian.jira.issue.comparator.IssueKeyComparator.compare(IssueKeyComparator.java:18)
      at org.apache.commons.collections.comparators.ComparatorChain.compare(ComparatorChain.java:277)

      The problem is that IssueKeyComparator is expecting a Issue object for certain compare's and GenericValues for others. The attached recompiled class file contains a fix. The code below replaces the code in the 'compare' routine:

      String key1 = null;
      String key2 = null;

      if (o1 == null && o2 == null)
      return 0;
      else if (o2 == null) // any value is greater than null
      return 1;
      else if (o1 == null) // null is less than any value
      return -1;

      if(o1 instanceof GenericValue && o2 instanceof GenericValue)

      { key1 = ((GenericValue ) o1).getString("key"); key2 = ((GenericValue ) o2).getString("key"); }

      else if(o1 instanceof Issue && o2 instanceof Issue)

      { key1 = ((Issue ) o1).getKey(); key2 = ((Issue ) o2).getKey(); }

      return KeyComparator.COMPARATOR.compare(key1, key2);

      Attachments

        Activity

          People

            jed Jed Wesley-Smith (Inactive)
            a09a4d781816 William Crighton [CCC]
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 3h
                3h