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

Entering a negative number of days in the Charting plugin causes OutOfMemoryException

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • High
    • 3.7
    • 3.7 Beta 2
    • Dashboard & Gadgets
    • None

    Description

      Entering a negative number in the days previously field causes an OutOfMemory exception. This is caused by the following block of code in com.atlassian.jira.ext.charting.data.DataUtils.java:

       public static void normaliseDateRange(Map dateMap, int days, Class period)
          {
              // find earliest date, then move it forwards until we hit now
              RegularTimePeriod cursor = RegularTimePeriod.createInstance(period, new Date(System.currentTimeMillis() - days * DateUtils.DAY_MILLIS), RegularTimePeriod.DEFAULT_TIME_ZONE);
              RegularTimePeriod now = RegularTimePeriod.createInstance(period, new Date(), RegularTimePeriod.DEFAULT_TIME_ZONE);
      
              while (!cursor.equals(now))
              {
                  if (!dateMap.containsKey(cursor))
                      dateMap.put(cursor, new Integer(0));
      
                  cursor = cursor.next();
              }
          }
      

      If days is a negative number, the while loop will never exit, and create a dateMap that will eventually use up all memory.

      The fix for this is to enter input checks for the charts listed below to check against negative values.

      Charts affected by this:

      • Recently Created Issues
      • Created vs Resolved Issues
      • Resolution time
      • Time to first Response
      • Average Age
      • Average Number of Times in Status
      • Time Since Issues

      Attachments

        Activity

          People

            Unassigned Unassigned
            andreask@atlassian.com Andreas Knecht (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - 0.5h
                0.5h
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 0.5h
                0.5h