aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/bitbucketpullrequestbuilder/bitbucketpullrequestbuilder/BitbucketRepository.java25
-rw-r--r--src/main/java/bitbucketpullrequestbuilder/bitbucketpullrequestbuilder/bitbucket/BuildState.java2
-rw-r--r--src/main/java/bitbucketpullrequestbuilder/bitbucketpullrequestbuilder/bitbucket/Pullrequest.java2
3 files changed, 23 insertions, 6 deletions
diff --git a/src/main/java/bitbucketpullrequestbuilder/bitbucketpullrequestbuilder/BitbucketRepository.java b/src/main/java/bitbucketpullrequestbuilder/bitbucketpullrequestbuilder/BitbucketRepository.java
index 2bf320b..3b0a314 100644
--- a/src/main/java/bitbucketpullrequestbuilder/bitbucketpullrequestbuilder/BitbucketRepository.java
+++ b/src/main/java/bitbucketpullrequestbuilder/bitbucketpullrequestbuilder/BitbucketRepository.java
@@ -291,17 +291,34 @@ public class BitbucketRepository {
}
private boolean isFilteredBuild(Pullrequest pullRequest) {
+
+ final String pullRequestId = pullRequest.getId();
+ final String pullRequestTitle = pullRequest.getTitle();
+ final String destinationRepoName = pullRequest.getDestination().getRepository().getRepositoryName();
+
+ // pullRequest.getDestination().getCommit() may return null for pull requests with merge conflicts
+ // * see: https://github.com/nishio-dens/bitbucket-pullrequest-builder-plugin/issues/119
+ // * see: https://github.com/nishio-dens/bitbucket-pullrequest-builder-plugin/issues/98
+ final String destinationCommitHash;
+ if (pullRequest.getDestination().getCommit() == null) {
+ logger.log(Level.INFO, "Pull request #{0} ''{1}'' in repo ''{2}'' has a null value for destination commit.",
+ new Object[]{pullRequestId, pullRequestTitle, destinationRepoName});
+ destinationCommitHash = null;
+ } else {
+ destinationCommitHash = pullRequest.getDestination().getCommit().getHash();
+ }
+
BitbucketCause cause = new BitbucketCause(
pullRequest.getSource().getBranch().getName(),
pullRequest.getDestination().getBranch().getName(),
pullRequest.getSource().getRepository().getOwnerName(),
pullRequest.getSource().getRepository().getRepositoryName(),
- pullRequest.getId(),
+ pullRequestId,
pullRequest.getDestination().getRepository().getOwnerName(),
- pullRequest.getDestination().getRepository().getRepositoryName(),
- pullRequest.getTitle(),
+ destinationRepoName,
+ pullRequestTitle,
pullRequest.getSource().getCommit().getHash(),
- pullRequest.getDestination().getCommit().getHash(),
+ destinationCommitHash,
pullRequest.getAuthor().getCombinedUsername()
);
diff --git a/src/main/java/bitbucketpullrequestbuilder/bitbucketpullrequestbuilder/bitbucket/BuildState.java b/src/main/java/bitbucketpullrequestbuilder/bitbucketpullrequestbuilder/bitbucket/BuildState.java
index e5c15ef..a3ef1f1 100644
--- a/src/main/java/bitbucketpullrequestbuilder/bitbucketpullrequestbuilder/bitbucket/BuildState.java
+++ b/src/main/java/bitbucketpullrequestbuilder/bitbucketpullrequestbuilder/bitbucket/BuildState.java
@@ -3,7 +3,7 @@ package bitbucketpullrequestbuilder.bitbucketpullrequestbuilder.bitbucket;
/**
* Valid build states for a pull request
*
- * @see https://confluence.atlassian.com/bitbucket/buildstatus-resource-779295267.html
+ * @see "https://confluence.atlassian.com/bitbucket/buildstatus-resource-779295267.html"
*/
public enum BuildState {
FAILED, INPROGRESS, SUCCESSFUL
diff --git a/src/main/java/bitbucketpullrequestbuilder/bitbucketpullrequestbuilder/bitbucket/Pullrequest.java b/src/main/java/bitbucketpullrequestbuilder/bitbucketpullrequestbuilder/bitbucket/Pullrequest.java
index 7ccad7d..b69805e 100644
--- a/src/main/java/bitbucketpullrequestbuilder/bitbucketpullrequestbuilder/bitbucket/Pullrequest.java
+++ b/src/main/java/bitbucketpullrequestbuilder/bitbucketpullrequestbuilder/bitbucket/Pullrequest.java
@@ -11,7 +11,7 @@ import org.codehaus.jackson.annotate.JsonProperty;
* POJOs representing the pull-requests extracted from the
* JSON response of the Bitbucket API V2.
*
- * @see https://confluence.atlassian.com/bitbucket/pullrequests-resource-423626332.html#pullrequestsResource-GETaspecificpullrequest
+ * @see "https://confluence.atlassian.com/bitbucket/pullrequests-resource-423626332.html#pullrequestsResource-GETaspecificpullrequest"
*/
@JsonIgnoreProperties(ignoreUnknown = true)