Null date value in the commits table causes incomplete export

Still need help?

The Atlassian Community is here for you.

Ask the community

Problem

Taking backup of your instance fails or ends prematurely, and the resulting backup has a poorly formed commits.xml file. The following NPE error message appears in the atlassian-bamboo.log file:

 2013-04-05 11:23:12,135 ERROR [ajp-8009-8] [XmlMigrator] Problems occurred while exporting
com.atlassian.bamboo.migration.stream.MapperExportException: java.lang.NullPointerException
	at com.atlassian.bamboo.migration.stream.CommitRootMapper$1.apply(CommitRootMapper.java:104)
	at com.atlassian.bamboo.migration.stream.CommitRootMapper$1.apply(CommitRootMapper.java:84)
	at com.atlassian.bamboo.commit.CommitHibernateDao$1.nextScrollableResult(CommitHibernateDao.java:45)
	at org.springframework.orm.hibernate.ScrollHibernateCallback.doInHibernate(ScrollHibernateCallback.java:54)
	at org.springframework.orm.hibernate.ScrollHibernateCallback.doInHibernate(ScrollHibernateCallback.java:13)
	at org.springframework.orm.hibernate.HibernateTemplate.execute(HibernateTemplate.java:370)
	at org.springframework.orm.hibernate.HibernateTemplate.execute(HibernateTemplate.java:337)
	at com.atlassian.bamboo.persistence.BambooHibernateObjectDao.executeReturnLong(BambooHibernateObjectDao.java:36)
	at com.atlassian.bamboo.commit.CommitHibernateDao.scrollCommitsForExport(CommitHibernateDao.java:32)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

Cause

This is caused by the fact that some commit messages have null values for the commit dates. You can view them by running this command:

 SELECT * FROM user_commit where COMMIT_DATE is null;

Resolution

  1. Stop Bamboo server
  2. Run the SQL query below against your Bamboo database to give arbitrary commit dates to the affected rows (discovered above):

     UPDATE user_commit set COMMIT_DATE='2013-04-08 17:16:41' where COMMIT_ID IN 
    (SELECT COMMIT_ID FROM (select COMMIT_ID from user_commit where COMMIT_DATE is null) as temp);
  3. Restart Bamboo


Last modified on Sep 16, 2018

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.