Skip to content

Commit

Permalink
Fix for GitHub issue #6
Browse files Browse the repository at this point in the history
It appears that the implementation of the Branch interface available
to an sBuild - and hence included in the webhook payload content - has
references to other objects that end up being circular.

From limited testing, this appears to be only evident on non-default
branches of VCS that support multiple branches in TeamCity. For example,
feature branches on GIT or HG.

To avoid these references, now pass a simple Branch bean to the content
message constructed from the implementation passed to tcWebHooks by
TeamCity.
  • Loading branch information
netwolfuk committed Jul 18, 2015
1 parent a46d606 commit 40a6b8d
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ private Branch getBranch() {
}

public void setBranch(Branch branch) {
this.branch = branch;
this.branch = new WebHooksBranchImpl(branch);
}

public String getBranchName() {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package webhook.teamcity.payload.content;

import jetbrains.buildServer.serverSide.Branch;

public class WebHooksBranchImpl implements Branch {

String displayName;
String name;
boolean isDefaultBranch;

public WebHooksBranchImpl(Branch branch) {
this.displayName = branch.getDisplayName();
this.name = branch.getName();
this.isDefaultBranch = branch.isDefaultBranch();
}

@Override
public String getDisplayName() {
return this.displayName;
}

@Override
public String getName() {
return this.name;
}

@Override
public boolean isDefaultBranch() {
return this.isDefaultBranch;
}

}

0 comments on commit 40a6b8d

Please sign in to comment.