Uploaded image for project: 'JIRA (including JIRA Core)'
  1. JIRA (including JIRA Core)
  2. JRA-2742

JIRA indexing breaks on unattached custom fields in old data

    Details

      Description

      A user has reported the following error when importing JIRA 2.0.2 data. The reindex after the upgrade fails with a NullPointerException:

      2003-11-17 15:51:41,113 WARN [jira.issue.index.DefaultIndexManager] There was an exception whilst reindexing issue XYZjava.lang.NullPointerException
      java.lang.NullPointerException
      at com.atlassian.jira.issue.comparator.CustomFieldComparator.compareProjects(CustomFieldComparator.java:100)
      at com.atlassian.jira.issue.comparator.CustomFieldComparator.compare(CustomFieldComparator.java:41)
      at java.util.Arrays.mergeSort(Arrays.java:1241)
      at java.util.Arrays.mergeSort(Arrays.java:1248)
      at java.util.Arrays.mergeSort(Arrays.java:1248)
      at java.util.Arrays.sort(Arrays.java:1188)
      at java.util.Collections.sort(Collections.java:153)
      at com.atlassian.jira.issue.managers.DefaultCustomFieldManager.getCustomFieldsFromDB(DefaultCustomFieldManager.j
      ava:238)
      at com.atlassian.jira.issue.managers.DefaultCustomFieldManager.populateCache(DefaultCustomFieldManager.java:360)

      at com.atlassian.jira.issue.managers.DefaultCustomFieldManager.getCustomField(DefaultCustomFieldManager.java:84)

      at com.atlassian.jira.issue.index.IssueDocument.getDocument(IssueDocument.java:79)
      at com.atlassian.jira.issue.index.DefaultIndexManager.indexIssueAndComments(DefaultIndexManager.java:186)
      at com.atlassian.jira.issue.index.DefaultIndexManager.reIndexIssues(DefaultIndexManager.java:113)
      at com.atlassian.jira.issue.index.DefaultIndexManager.reIndexAll(DefaultIndexManager.java:76)
      at com.atlassian.jira.upgrade.tasks.AbstractReindexUpgradeTask.doUpgrade(AbstractReindexUpgradeTask.java:17)
      at com.atlassian.jira.upgrade.UpgradeManagerImpl.doUpgradeTaskSucess(UpgradeManagerImpl.java:565)
      at com.atlassian.jira.upgrade.UpgradeManagerImpl.doUpgrade(UpgradeManagerImpl.java:318)
      at com.atlassian.jira.upgrade.UpgradeManagerImpl.doUpgradeIfNeeded(UpgradeManagerImpl.java:264)
      at com.atlassian.jira.upgrade.UpgradeManagerImpl.doUpgradeIfNeededAndAllowed(UpgradeManagerImpl.java:252)
      at com.atlassian.jira.upgrade.UpgradeLauncher.contextInitialized(UpgradeLauncher.java:70)
      at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3271)

      It looks like back in 2.0.2, JIRA did not delete a project's custom fields when deleting the project. As a result there are custom fields floating around without an associated project, and this kills indexing.

        Attachments

          Activity

          Hide
          owen@atlassian.com Owen Fellows added a comment -

          Added more checking in CustomFieldComparator so NPE are not thrown for invalid projects.

          Show
          owen@atlassian.com Owen Fellows added a comment - Added more checking in CustomFieldComparator so NPE are not thrown for invalid projects.

            People

            • Assignee:
              owen@atlassian.com Owen Fellows
              Reporter:
              jefft Jeff Turner
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: