NullPointerException thrown when loading events from imported calendar

Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.

Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible

Problem

After importing a .ics calendar, its events will not load and the following stack trace is seen in the UI and in atlassian-confluence.log file:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Unable to load events of <Calendar-Name> (<Calendar-ID>): java.lang.NullPointerException at com.atlassian.confluence.extra.calendar3.model.SubCalendarEvent.compareTo(SubCalendarEvent.java:700) at com.atlassian.confluence.extra.calendar3.model.SubCalendarEvent.compareTo(SubCalendarEvent.java:27) at java.util.ComparableTimSort.mergeLo(ComparableTimSort.java:684) at java.util.ComparableTimSort.mergeAt(ComparableTimSort.java:481) at java.util.ComparableTimSort.mergeCollapse(ComparableTimSort.java:404) at java.util.ComparableTimSort.sort(ComparableTimSort.java:213) at java.util.Arrays.sort(Arrays.java:1312) at java.util.Arrays.sort(Arrays.java:1506) at java.util.ArrayList.sort(ArrayList.java:1462) at java.util.Collections.sort(Collections.java:141) at com.atlassian.confluence.extra.calendar3.ical4j.RecurrenceRuleProcessor.getRecurrenceEvents(RecurrenceRuleProcessor.java:222) at com.atlassian.confluence.extra.calendar3.DefaultCalendarManager.getEvents(DefaultCalendarManager.java:717) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:302) at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157) at com.atlassian.plugins.spring.interceptor.plugin.ExportableInterceptorAdapter$WrappedMethodInvocation.proceed(ExportableInterceptorAdapter.java:53) at com.atlassian.plugins.spring.interceptor.spi.SpringInterceptorAdapter$SpringMethodInvocationAdapter.proceed(SpringInterceptorAdapter.java:50) at com.atlassian.spring.interceptors.SpringProfilingInterceptor.invoke(SpringProfilingInterceptor.java:16) at com.atlassian.plugins.spring.interceptor.spi.SpringInterceptorAdapter.invoke(SpringInterceptorAdapter.java:23) at sun.reflect.GeneratedMethodAccessor485.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at com.atlassian.plugin.util.ContextClassLoaderSettingInvocationHandler.invoke(ContextClassLoaderSettingInvocationHandler.java:26) at ...

Note

This problem was only observed after importing calendars from third-party applications so far, not with .ics files from Team Calendars itself. Outlook calendarsare an example that can face this issue.

Cause

By inspecting the source code, we can see that the NullPointerException comes from this line:

1 return name.compareTo(subCalendarEvent.name);

As we can see, this line looks for the event name, which is also referred as summary. This leads to believe that the calendar has events with Null or empty name/summary.

Workaround

Proceed as follows to confirm the problem and resolve it:

  • Import the problematic calendar into Team Calendars

  • Export it again so TC will apply its own formatting to the .ics file

  • Open the .ics export in a text editor and search for this pattern:

    1 SUMMARY:
  • Go over all matches and check if there are summaries empty

  • If empty summaries exist, add a temporary name to them, as in the example

    1 SUMMARY:placeholdername
  • Make sure that there are no empty summaries on the file and save it

  • Import the fixed .ics and confirm if you can load the events of the calendar

Updated on April 15, 2025

Still need help?

The Atlassian Community is here for you.