Uploaded image for project: 'Jira Server and Data Center'
  1. Jira Server and Data Center
  2. JRASERVER-67697

Browse projects responds with 500 when any issue has issuetype=null in database

    XMLWordPrintable

    Details

      Description

      Environment

      • Only affects JIRA Administration -> Projects (Admin mode)
      • It's not known why issuetype=null in database

      Steps to reproduce

      1. Create a project with any number of issues
      2. In database set issue type of any issue to null value
        update jiraissue set issuetype = null where id = <issue_id>
        
      3. Reindex Jira
      4. Go to <Jira URL>/secure/project/BrowseProjects.jspa

      Expected result

      Page loads correctly

      Actual result

      Page responds with 500 showing following stacktrace:

      java.lang.NullPointerException
      	at com.atlassian.jira.web.action.browser.ProjectDataForArchivingCollector.lambda$getMapToUpdatedDate$1236(ProjectDataForArchivingCollector.java:50) [classes/:?]
      	at java.util.stream.Collectors.lambda$toMap$173(Collectors.java:1321) [?:1.8.0_65]
      	at java.util.stream.ReduceOps$3ReducingSink.accept(ReduceOps.java:169) [?:1.8.0_65]
      	at java.util.HashMap$EntrySpliterator.forEachRemaining(HashMap.java:1683) [?:1.8.0_65]
      	at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481) [?:1.8.0_65]
      	at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471) [?:1.8.0_65]
      	at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708) [?:1.8.0_65]
      	at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) [?:1.8.0_65]
      	at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499) [?:1.8.0_65]
      	at com.atlassian.jira.web.action.browser.ProjectDataForArchivingCollector.getMapToUpdatedDate(ProjectDataForArchivingCollector.java:50) [classes/:?]
      	at com.atlassian.jira.web.action.browser.BrowseProjects$2.get(BrowseProjects.java:169) [classes/:?]
      	at com.atlassian.jira.web.action.browser.BrowseProjects$2.get(BrowseProjects.java:153) [classes/:?]
      	at com.google.common.base.Suppliers$MemoizingSupplier.get(Suppliers.java:125) [guava-18.0.jar:?]
      	at com.atlassian.jira.web.action.browser.BrowseProjects.doExecute(BrowseProjects.java:287) [classes/:?]
      	at webwork.action.ActionSupport.execute(ActionSupport.java:165) [webwork-1.4-atlassian-30.jar:?]
      	at com.atlassian.jira.action.JiraActionSupport.execute(JiraActionSupport.java:63) [jira-api-7.11.3-SNAPSHOT.jar:?]
      	at webwork.interceptor.DefaultInterceptorChain.proceed(DefaultInterceptorChain.java:39) [webwork-1.4-atlassian-30.jar:?]
      	at webwork.interceptor.NestedInterceptorChain.proceed(NestedInterceptorChain.java:31) [webwork-1.4-atlassian-30.jar:?]
      	at webwork.interceptor.ChainedInterceptor.intercept(ChainedInterceptor.java:16) [webwork-1.4-atlassian-30.jar:?]
      	at webwork.interceptor.DefaultInterceptorChain.proceed(DefaultInterceptorChain.java:35) [webwork-1.4-atlassian-30.jar:?]
      	at webwork.dispatcher.GenericDispatcher.executeAction(GenericDispatcher.java:225) [webwork-1.4-atlassian-30.jar:?]
      	at webwork.dispatcher.GenericDispatcher.executeAction(GenericDispatcher.java:154) [webwork-1.4-atlassian-30.jar:?]
      	at com.atlassian.jira.web.dispatcher.JiraWebworkActionDispatcher.service(JiraWebworkActionDispatcher.java:138) [classes/:?]
      	at javax.servlet.http.HttpServlet.service(HttpServlet.java:742) [servlet-api.jar:?]
      	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231) [catalina.jar:8.5.29]
              ...
      

      Workaround

      Before executing this operation please back up your system

      To ensure data integrity, the following steps should be followed:

      1. Identify the offending issue and its important field values with this SQL query:
        select j.id, j.project, p.pkey, j.issuenum, j.issuetype, j.summary, j.description, j.issuestatus, j.workflow_id
        from jiraissue j inner join project p on j.project = p.id
        where j.issuetype is null order by p.pkey, j.issuenum;
        

        Sample output:

        id	project	pkey	issuenum	issuetype	summary	description	issuestatus	workflow_id
        11300	10200	PUB	3	NULL	test	NULL	10001	11002
        

        Take note of issue ID 11300 for the last step

      2. From GUI, create a new issue in project PUB (found above) of any issue type
      3. View the new issue -> Mouse over Edit button -> Get issue ID from browser status bar e.g. 11400
      4. Run this query to get the same data of the new issue:
        select j.id, j.project, p.pkey, j.issuenum, j.issuetype, j.summary, j.description, j.issuestatus, j.workflow_id
        from jiraissue j inner join project p on j.project = p.id
        where j.id = 11400
        

        Sample output:

        id	project	pkey	issuenum	issuetype	summary	description	issuestatus	workflow_id
        11400	10200	PUB	14	10002	test	NULL	10000	11500
        
      5. Update the offending issue (use ID from step 1) with the same issuetype, issuestatus, and workflow_id returned above (if necessary update its summary and description as well):
        update jiraissue set issuetype = 10002, issuestatus = 10000, workflow_id = 11500 where id = 11300;
        

        This will place the issue in the right type, workflow, and status

      6. Restart and re-index JIRA
        If only 1 project is affected, re-index only that project

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              izinoviev Ilya Zinoviev (Inactive)
              Reporter:
              pczuj Przemyslaw Czuj
              Votes:
              1 Vote for this issue
              Watchers:
              8 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: