-
Type:
Bug
-
Resolution: Unresolved
-
Priority:
Low
-
None
-
Affects Version/s: TC-7.0.17
-
Component/s: Apps - Team Calendar
-
None
-
7
-
Severity 3 - Minor
-
0
Issue Summary
The Sub Calendar with TIME_ZONE_ID columns is null and the owner is deleted (remove from user_mapping) will throw Null exception, users cannot add or view the calendar correctly.
Steps to Reproduce
- Start confluence and restore from the backup file in the ticket
- Install Teamcal 7.0.17
- Go to database and search for sub calendar with creator is removed from user_mapping
SELECT COLOUR, CREATED, CREATOR, DESCRIPTION, ID, LAST_MODIFIED, NAME, PARENT_ID, SPACE_KEY, STORE_KEY, SUBSCRIPTION_ID, TIME_ZONE_ID, USING_CUSTOM_EVENT_TYPE_ID FROM AO_950DC3_TC_SUBCALS WHERE CREATOR NOT IN (SELECT USER_KEY FROM USER_MAPPING);
- Set the time_zone_id column to null for any sub calendar above
- Navigate to the space of above calendar.
Expected Results
Can see and add event normally
Actual Results
The below exception is thrown in the xxxxxxx.log file:
java.lang.NullPointerExceptionjava.lang.NullPointerException at java.util.concurrent.ConcurrentHashMap.get(ConcurrentHashMap.java:936) at com.atlassian.confluence.extra.calendar3.DefaultJodaIcal4jTimeZoneMapper.isTimeZoneIdAnAlias(DefaultJodaIcal4jTimeZoneMapper.java:148) at com.atlassian.confluence.extra.calendar3.calendarstore.generic.ParentSubCalendarDataStore.fromStorageFormat(ParentSubCalendarDataStore.java:130) at com.atlassian.confluence.extra.calendar3.calendarstore.generic.ParentSubCalendarDataStore.fromStorageFormat(ParentSubCalendarDataStore.java:47) at com.atlassian.confluence.extra.calendar3.calendarstore.AbstractCalendarDataStore.getSubCalendar(AbstractCalendarDataStore.java:984) at com.atlassian.confluence.extra.calendar3.calendarstore.SanboxSubCalendarDataStoreCachingDecorator.getSubCalendar(SanboxSubCalendarDataStoreCachingDecorator.java:92) at com.atlassian.confluence.extra.calendar3.calendarstore.DelegatingCalendarDataStore.lambda$getSubCalendarsWithRestriction$2(DelegatingCalendarDataStore.java:121) at com.google.common.collect.Iterators$6.transform(Iterators.java:785)
Workaround
- Set the value time_zone_id to valid timezone alias
- Or, re-assign new sub calendar onwer (creator) column
The user for log in: admin/charlie
The code that cause problem, the map will throw null excpetion if the key is null
public boolean isTimeZoneIdAnAlias(String alias) { String timeZoneId = timeZoneAliases.get(alias); while (null != timeZoneId && timeZoneAliases.containsKey(timeZoneId)) timeZoneId = timeZoneAliases.get(timeZoneId); return null != timeZoneId; }
and
parentSubCalendar.setTimeZoneId(subCalendarEntity.getTimeZoneId()); if (StringUtils.isBlank(parentSubCalendar.getTimeZoneId())) { // If timeZoneId property is null, this is most probably because it's a JiraSubCalendar that was migrated as a ParentSubCalendar + JIRA child sub-calendars. String creator = parentSubCalendar.getCreator(); if (StringUtils.isNotBlank(creator)) { ConfluenceUser creatorUser = getUserAccessor().getUserByKey(new UserKey(creator)); if (null != creatorUser) parentSubCalendar.setTimeZoneId(jodaIcal4jTimeZoneMapper.getUserTimeZoneIdJoda(creatorUser)); } }