Missed Team ’24? Catch up on announcements here.

×
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

NullPointer when retrieving files from CommitContext

Jan Swaelens
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 17, 2013

Hello,

Since we updated to bamboo 4.4.5 we are getting nullpointer errors in once of our plugins at the point where it tries to iterate over the file collection obtained from 'com.atlassian.bamboo.commit.CommitContext.getFiles()'. Both the iterator or toArray methods are yielding the following errors:

java.lang.NullPointerException
	at java.util.ArrayList.get(ArrayList.java:324)
	at java.util.AbstractList$Itr.next(AbstractList.java:345)
	at foo.bar.bamboo.plugins.ChangeSetCollectorTask.execute(ChangeSetCollectorTask.java:94)

What can I do to get by, this doesn't seem right? This was not happening on an earlier 4.4 version as far as I know.

The repo that is used is an SVN.

thanks!

3 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
Answer accepted
Jan Swaelens
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 2, 2013

The problem is resolved in the Bamboo 5 release.

1 vote
Jan Swaelens
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 23, 2013

I managed to zero the breakage in, it happens only on the 4.4.5 release, I switched versions until I was able to reproduce. You can download the plugin from the Atlassian Marketplace, it's called bamboo-changesetcollector-plugin. You only need to hook-up an svn repo, add the task and check the source jar option (no extra config needed). Then do the inital build and then make a change that triggers the change set build to get the nullpointer.

I did some diff-ing on the source between 4.4.4 and 4.4.5 and found that there are some changes on CommitContext and other related classes -- not sure what could be the cause though.

thanks!

Jobin Kuruvilla [Adaptavist]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 23, 2013

Good find about the version. I ran across this as well!

0 votes
Przemek Bruski
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 18, 2013

Can you post the complete stack trace?

Jan Swaelens
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 18, 2013

Sure, here it is:

java.lang.NullPointerException
	at java.util.ArrayList.get(ArrayList.java:324)
	at java.util.AbstractList$Itr.next(AbstractList.java:345)
	at foo.bar.bamboo.plugins.ChangeSetCollectorTask.execute(ChangeSetCollectorTask.java:94)
	at com.atlassian.bamboo.task.TaskExecutorImpl.executeTasks(TaskExecutorImpl.java:188)
	at com.atlassian.bamboo.task.TaskExecutorImpl.execute(TaskExecutorImpl.java:94)
	at com.atlassian.bamboo.build.pipeline.tasks.ExecuteBuildTask.call(ExecuteBuildTask.java:87)
	at com.atlassian.bamboo.v2.build.agent.DefaultBuildAgent.build(DefaultBuildAgent.java:206)
	at com.atlassian.bamboo.v2.build.agent.BuildAgentControllerImpl.waitAndPerformBuild(BuildAgentControllerImpl.java:103)
	at com.atlassian.bamboo.v2.build.agent.DefaultBuildAgent$1.run(DefaultBuildAgent.java:111)
	at com.atlassian.bamboo.build.pipeline.concurrent.NamedThreadFactory$2.run(NamedThreadFactory.java:52)
	at java.lang.Thread.run(Thread.java:662)

I also had a look in debug mode (we created the plugin) and I can't even inspect the list in the debug view, it also yields the error. Something strange seems to be going on internally in that list implementation?

Jan Swaelens
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 18, 2013

This is the code which eventually gets to the method call:

List<CommitContext> changes = taskContext.getBuildContext().getBuildChanges().getChanges(repoId.intValue());
if(!changes.isEmpty()){

  Iterator<CommitContext> it = changes.iterator();
  List<String> deltaFiles = new ArrayList<String>();
  while (it.hasNext()) {
		    
    // Pull changes for this commit
    CommitContext commitContext = (CommitContext) it.next();
    List<CommitFile> files = commitContext.getFiles();

TAGS
AUG Leaders

Atlassian Community Events