Permalink
Browse files

Fix for GitHub issue #6

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 40a6b8df6f0de39f854cccb4e65dc59384432cc6
@@ -207,7 +207,7 @@ private Branch getBranch() {
}
public void setBranch(Branch branch) {
this.branch = branch;
this.branch = new WebHooksBranchImpl(branch);
}
public String getBranchName() {
@@ -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.