Skip to content

Commit d6759dc

Browse files
committed
Minor tweaks
1 parent f7b3a48 commit d6759dc

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

src/main/java/com/cloudbees/jenkins/plugins/bitbucket/client/BitbucketCloudApiClient.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -306,8 +306,9 @@ public List<BitbucketPullRequestValue> getPullRequests() throws InterruptedExcep
306306
pullRequests.addAll(page.getValues());
307307
} while (page.getNext() != null);
308308

309-
// PRs with missing destination branch are invalid and should be ignored.
309+
// PRs with missing source or destination branch are invalid and should be ignored.
310310
pullRequests.removeIf(pr -> pr.getSource().getRepository() == null
311+
|| pr.getSource().getBranch() == null
311312
|| pr.getSource().getCommit() == null
312313
|| pr.getDestination().getBranch() == null
313314
|| pr.getDestination().getCommit() == null);

src/main/java/com/cloudbees/jenkins/plugins/bitbucket/client/events/BitbucketCloudPullRequestEvent.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,7 @@ private void reconstructMissingData() {
9090
}
9191
}
9292
}
93-
}
94-
if (source != null) {
93+
9594
BitbucketCloudBranch sourceBranch = source.getBranch();
9695
BitbucketCommit sourceCommit = source.getCommit();
9796
if (sourceCommit != null

src/main/java/com/cloudbees/jenkins/plugins/bitbucket/server/client/BitbucketServerAPIClient.java

+4-2
Original file line numberDiff line numberDiff line change
@@ -329,10 +329,12 @@ private List<BitbucketServerPullRequest> getPullRequests(UriTemplate template)
329329
throws IOException, InterruptedException {
330330
List<BitbucketServerPullRequest> pullRequests = getResources(template, BitbucketServerPullRequests.class);
331331

332-
// PRs with missing destination branch are invalid and should be ignored.
332+
// PRs with missing source or destination branch are invalid and should be ignored.
333333
pullRequests.removeIf(pr -> pr.getSource().getRepository() == null
334334
|| pr.getSource().getBranch() == null
335-
|| pr.getDestination().getBranch() == null);
335+
|| pr.getSource().getCommit() == null
336+
|| pr.getDestination().getBranch() == null
337+
|| pr.getDestination().getCommit() == null);
336338

337339
// set commit closure to make commit informations available when need, in a similar way to when request branches
338340
for (BitbucketServerPullRequest pullRequest : pullRequests) {

0 commit comments

Comments
 (0)