Bamboo build using SVN repository for plans imported via Java specs scan fails with NullPointerException

Still need help?

The Atlassian Community is here for you.

Ask the community


Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.

Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible

Summary

This knowledge-base article covers a scenario where a build fails for a plan which was created via Java specs scan import ( via an IDE ). The plan has a SVN repository linked locally.

The import of the plan is successful but the build fails with java.lang.NullPointerException which is seen in the build logs. 

Environment

The issue is seen on Bamboo 9.1.0 but it might be applicable for any other supported version of Bamboo. 

Diagnosis

The first step towards diagnosis is to refer the Bamboo build logs for the plan which is failing, the logs point to java.lang.NullPointerException as seen below:

ERROR [7-DelayedChangeDetectionThread:pool-10-thread-4] [ChainExecutionManagerImpl] Errors getting changes for job-key
com.atlassian.bamboo.repository.RepositoryException: java.lang.NullPointerException at
com.atlassian.bamboo.v2.trigger.DefaultChangeDetectionManager.collectChangesSinceLastBuildInternal(DefaultChangeDetectionManager.java:443) ~[atlassian-bamboo-core-9.1.0.jar:?]
...
Caused by: java.lang.NullPointerException
	at com.atlassian.bamboo.repository.svn.v2.AbstractSvnExecutor.getSubstitutedAccessDataBuilder(AbstractSvnExecutor.java:166) ~[atlassian-bamboo-core-9.1.0.jar:?]


(info) An interesting point to note is that the build works properly if the same repository is saved manually after import from Bamboo GUI by going to configure plan > repositories tab.

Cause

The cause of the issue is incorrect specs code for the repository section of the plan, it is missing the section for branch configuration and as per the error above, Bamboo is looking for the branch name and hence NullPointerException:

Specs code imported via IDE
.planRepositories(new AnyVcsRepository(new AtlassianModule("com.atlassian.bamboo.plugin.system.repository:svnv2"))
.name("test-svn-repository")
.serverConfiguration(new MapBuilder()
.put("repository.svn.useExternals", false)
.put("repository.svn.tag.create.autodetectPath", true)
.put("repository.svn.authType", "password")
.put("repository.svn.username", "test")
.put("repository.svn.branch.create.autodetectPath", true)
.put("repository.svn.userPassword", "BAMSCRT@0@0@+test")
.put("repository.svn.repositoryRoot", "<https://test.com/trunk")>
.build()))

The above specs code is missing the below sections related to branch configuration

Missing blocks
branchConfiguration(new MapBuilder()
.put("repository.svn.branch.displayName", "trunk")
.put("repository.svn.branch.path", "")
.build())
.changeDetectionConfiguration(new VcsChangeDetection()))

Solution

The solution is to combine the above 2 sections as described in the cause section above for the specs and reimport the Java specs, kindly refer below

.planRepositories(new AnyVcsRepository(new AtlassianModule("com.atlassian.bamboo.plugin.system.repository:svnv2"))
.name("test-svn-repository")
.serverConfiguration(new MapBuilder()
.put("repository.svn.useExternals", false)
.put("repository.svn.tag.create.autodetectPath", true)
.put("repository.svn.authType", "password")
.put("repository.svn.username", "test")
.put("repository.svn.branch.create.autodetectPath", true)
.put("repository.svn.userPassword", "BAMSCRT@0@0@+test")
.put("repository.svn.useExport", false)
.put("repository.svn.repositoryRoot", "<https://test.com/trunk")>
.build())
.branchConfiguration(new MapBuilder()
.put("repository.svn.branch.displayName", "trunk")
.put("repository.svn.branch.path", "")
.build())
.changeDetectionConfiguration(new VcsChangeDetection()))

(info) Please make sure to change the username, password, repositoryRooturl and branch name with appropriate values for your own instance. 




Last modified on May 5, 2023

Was this helpful?

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