Uploaded image for project: 'Jira Software Data Center'
  1. Jira Software Data Center
  2. JSWSERVER-13909

NPE when adding a repository path due to previously deleted JIRA projects

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Low
    • None
    • Unknown
    • Fisheye Plugin

    Description

      Attempting to add a repository path in JIRA throws the following exceptions:

      Cause
      Referer URL: http://localhost:8070/jira/secure/admin/AssociateProjectRepPath!default.jspa?projectId=10101&fromScreen=prj
      java.lang.NullPointerException
      java.lang.NullPointerException
      	at com.atlassian.jirafisheyeplugin.config.fisheye.RepositoryPathStoreImpl.getProjectId(RepositoryPathStoreImpl.java:63)
      	at com.atlassian.jirafisheyeplugin.config.fisheye.RepositoryPathStoreImpl.access$400(RepositoryPathStoreImpl.java:32)
      	at com.atlassian.jirafisheyeplugin.config.fisheye.RepositoryPathStoreImpl$3.with(RepositoryPathStoreImpl.java:131)
      	at com.atlassian.jirafisheyeplugin.config.fisheye.RepositoryPathStoreImpl.forEachApplicationLink(RepositoryPathStoreImpl.java:144)
      	at com.atlassian.jirafisheyeplugin.config.fisheye.RepositoryPathStoreImpl.reloadRepositoryPaths(RepositoryPathStoreImpl.java:118)
      	at com.atlassian.jirafisheyeplugin.web.admin.AssociateProjectRepositoryPath.doExecute(AssociateProjectRepositoryPath.java:152)
      	at webwork.action.ActionSupport.execute(ActionSupport.java:165)
      

      Attempting to refresh the Fisheye Global configuration also throw this error:

      2015-01-20 18:45:21,568 http-bio-8070-exec-8 ERROR admin 1125x798x1 an41kg 127.0.0.1 /secure/admin/ViewFishEyeConfig.jspa [jira.web.dispatcher.JiraWebworkActionDispatcher] Exception thrown from action 'ViewFishEyeConfig', returning 404 
      org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.atlassian.jirafisheyeplugin.web.admin.ViewFishEyeConfiguration': Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [com.atlassian.jirafisheyeplugin.web.admin.ViewFishEyeConfiguration]: Constructor threw exception; nested exception is java.lang.NullPointerException
      	at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:254)
      	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:925)
      	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:835)
      	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:440)
      	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
      ...
      Caused by: java.lang.NullPointerException
      	at com.atlassian.jirafisheyeplugin.config.fisheye.RepositoryPathStoreImpl.access$400(RepositoryPathStoreImpl.java:32)
      	at com.atlassian.jirafisheyeplugin.config.fisheye.RepositoryPathStoreImpl$3.with(RepositoryPathStoreImpl.java:131)
      	at com.atlassian.jirafisheyeplugin.config.fisheye.RepositoryPathStoreImpl.forEachApplicationLink(RepositoryPathStoreImpl.java:144)
      	at com.atlassian.jirafisheyeplugin.config.fisheye.RepositoryPathStoreImpl.reloadRepositoryPaths(RepositoryPathStoreImpl.java:118)
      	at com.atlassian.jirafisheyeplugin.config.fisheye.RepositoryPathStoreImpl.refresh(RepositoryPathStoreImpl.java:149)
      	at com.atlassian.jirafisheyeplugin.config.RefreshManagerImpl.refreshRefreshables(RefreshManagerImpl.java:162)
      	at com.atlassian.jirafisheyeplugin.config.RefreshManagerImpl.refreshAll(RefreshManagerImpl.java:80)
      

      Steps to reproduce:

      1. Create a project.
      2. Associate this project with a Repository Path by going to the project's Administration page, scroll down to the Repository Paths section and add one there.
      3. Delete this project after that.
      4. Create a second project, but ensure that the project key is different from the deleted project earlier.
      5. Try to add a Repository Path to this project. It will fail with the 500-page error.

      Root Cause:

      1. The NPE is caused by the fact that JIRA does not update the list of projects with repository paths in the database.
      2. Running the following SQL:
        SELECT * FROM propertyentry LEFT JOIN propertystring ON propertyentry.ID = propertystring.ID WHERE PROPERTY_KEY LIKE '%fisheye.projects.with.repository.paths%';
        
      3. This will populate a list of JIRA project keys that have repository paths configured.
      4. You will notice that this list still contains project keys of previously deleted JIRA projects.
      5. The NPE occurs when the Fisheye plugin tries to retrieve the ID of a non-existent JIRA project key.

      Workaround Steps:

      1. Update the propertystring table row (the fisheye.projects.with.repository.paths property entry) to remove the project keys that do not exist in JIRA or has been deleted.
      2. Restart JIRA for the database changes to take effect.
        ALWAYS have a database backup handy before attempting to modify production data, or test it in a staging instance first.

      Tested Versions:

      1. Fisheye 3.5.1 with JIRA 6.3.9
      2. Fisheye 3.6.2 with JIRA 6.3.9
      3. Fisheye 3.6.2 with JIRA 6.3.12
      4. Fisheye 3.7 with JIRA 6.3.14

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              dleng Daniel Leng (Inactive)
              Votes:
              2 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated: