Uploaded image for project: 'Confluence Data Center'
  1. Confluence Data Center
  2. CONFSERVER-58642

Subscribing to Team Calendars in Confluence with events from restricted or inexistent Jira projects might fail

    XMLWordPrintable

Details

    Description

      Issue Summary

      Confluence users can subscribe to Team Calendars and get an updated list of events from Confluence in their preferred calendar app as described in Subscribe to and from Team Calendars.
      If users subscribe to a Calendar that has events from a restricted or an inexistent Jira project (see Add Jira Events for further information), then Confluence will throw an error instead of gracefully bypassing events associated to that project.

      Steps to Reproduce

      1. Install a vanilla instance of Jira Software.
        • This was validated with Jira Software 7.9.2 but should not be tied to a specific Jira version.
      2. As the Jira administrator, create a sample project.
        1. Go to Projects > Create project > Create sample data.
        2. Select Project management and click on Next.
        3. Use the following information to create the project: Name: Test Project ; Key: TSTPRJ; Project Lead: jira administrator
      3. Restrict the Browse Projects permissions just to Jira administrators, removing the permission to any logged user.
      4. Create a regular Jira user, which is added just to the jira-software-users group.
        • username: user001
      5. Install a vanilla instance of Confluence.
        • This was validated with Confluence 6.13.3 but should not be tied to a specific Confluence version.
      6. Install Team Calendars.
        • This was validated with Team Calendars 6.0.37.
      7. Create a regular Confluence user, which is added just to the confluence-users group.
        • username: user001
      8. Create an application link between Confluence and Jira.
      9. Create a blank space: Space Name: Test-Team-Calendars; Space Key: TTC
      10. Go to <Confluence Base URL>/display/TTC/calendars and add a new calendar.
        • Name: Test Calendar
      11. Within Test Calendar, click on ... > Add event.
        • Select Event Type: Jira Issue Dates; Name: Test Project Calendar; Display: JQL (advanced); JQL: project = "Test Project"; Show: Issue Created Date
        • At this point the events are added and the administrator has visibility to the events in the calendar.
      12. As user001 access <Confluence Base URL>/display/TTC/calendars and click on Subscribe.
        • Choose Calendar: Test Calendar; Calendar app: iCal
      13. Copy the Team Calendars URL and paste it in the browser.

      Expected Results

      A pop-up is given by the browser so the user can download an .ics file.
      Confluence gracefully handles the fact the Jira project is restricted and doesn't include events from this sub-calendar, but still shows events from other sub-calendars.

      Actual Results

      Confluence answers with HTTP 500 status and with a java.lang.NullPointerException to the user.
      An error similar to the below is logged in atlassian-confluence.log:

      2019-07-29 20:00:19,388 ERROR [http-nio-26133-exec-5] [extra.calendar3.calendarstore.JiraCalendarDataStore] getSubCalendarContentInternal The JQL query for project = "Change This" didn't return any results. Try changing the query.
       -- url: /c6133/rest/calendar-services/1.0/calendar/export/subcalendar/private/2e98b166a615cf7514ce8aed31452ebe922608bf.ics | traceId: ab23bcd31934a9b9 | userName: user001
      2019-07-29 20:00:19,390 ERROR [http-nio-26133-exec-5] [extra.calendar3.calendarstore.CalendarDataStoreCachingDecorator] load Could not load calendar content from cache key
       -- url: /c6133/rest/calendar-services/1.0/calendar/export/subcalendar/private/2e98b166a615cf7514ce8aed31452ebe922608bf.ics | traceId: ab23bcd31934a9b9 | userName: user001
      com.atlassian.confluence.extra.calendar3.exception.CalendarException: calendar3.jira.error.jqlwrong.one
      	at com.atlassian.confluence.extra.calendar3.calendarstore.AbstractJiraSubCalendarDataStore.getSubCalendarContentInternal(AbstractJiraSubCalendarDataStore.java:498)
      	at com.atlassian.confluence.extra.calendar3.calendarstore.AbstractJiraSubCalendarDataStore.getSubCalendarContentInternal(AbstractJiraSubCalendarDataStore.java:80)
      	at com.atlassian.confluence.extra.calendar3.calendarstore.ExternalCalendarDataStore.getSubCalendarContent(ExternalCalendarDataStore.java:54)
      	at com.atlassian.confluence.extra.calendar3.calendarstore.CalendarDataStoreCachingDecorator.getSubCalendarContentFromCalendarDataStore(CalendarDataStoreCachingDecorator.java:274)
      	at com.atlassian.confluence.extra.calendar3.calendarstore.CalendarDataStoreCachingDecorator.access$200(CalendarDataStoreCachingDecorator.java:63)
      	at com.atlassian.confluence.extra.calendar3.calendarstore.CalendarDataStoreCachingDecorator$1.load(CalendarDataStoreCachingDecorator.java:93)
      	at com.atlassian.confluence.extra.calendar3.calendarstore.CalendarDataStoreCachingDecorator$1.load(CalendarDataStoreCachingDecorator.java:80)
      	at com.atlassian.cache.ehcache.LoadingCache.getFromLoader(LoadingCache.java:145)
      

      The user is unable to subscribe to the Calendar.

      Notes

      The same problem occurs if the target project is unrestricted in Jira, but had its name/key changed after the calendar was created in Confluence, invalidating the JQL query.

      Workaround

      There's no straightforward workaround to the subscribe use case and still keep the original data in Confluence.
      The problematic JQL can be determined by the error in Confluence log.
      One of the following options can be used with their possible consequences:

      • If the Jira project was renamed, then search for the Calendars pointing to it and update the JQL filter.
      • If the Jira project was removed, then search for the event pointing to it and remove it.
      • If the Jira project is restricted to certain users, removing it from a public calendar may be an option to certain use cases.

      If applicable, exporting the calendar to an .ics file as explained in this KB still works.

      Attachments

        Issue Links

          Activity

            People

              dluong Duy Truong Luong
              tmasutti Thiago Masutti
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: