From 42c76f68a842740c21727e5a8229e9294ff3c203 Mon Sep 17 00:00:00 2001 From: Martin Damovsky Date: Mon, 20 Feb 2017 10:53:29 +0100 Subject: [maven-release-plugin] prepare release bitbucket-pullrequest-builder-1.4.20 --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 98d2446..fa7bbbf 100644 --- a/pom.xml +++ b/pom.xml @@ -8,7 +8,7 @@ bitbucket-pullrequest-builder Bitbucket Pullrequest Builder Plugin - 1.4.20-SNAPSHOT + 1.4.20 This Jenkins plugin builds pull requests from Bitbucket.org and will report the test results. hpi https://wiki.jenkins-ci.org/display/JENKINS/Bitbucket+pullrequest+builder+plugin @@ -17,7 +17,7 @@ scm:git:ssh://git@github.com/jenkinsci/bitbucket-pullrequest-builder-plugin.git scm:git:ssh://git@github.com/jenkinsci/bitbucket-pullrequest-builder-plugin.git https://github.com/jenkinsci/bitbucket-pullrequest-builder-plugin.git - HEAD + bitbucket-pullrequest-builder-1.4.20 -- cgit v1.2.3 From d6add0ce1f04133e65c0ec10b03268bded3818f0 Mon Sep 17 00:00:00 2001 From: Martin Damovsky Date: Mon, 20 Feb 2017 10:53:36 +0100 Subject: [maven-release-plugin] prepare for next development iteration --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index fa7bbbf..0b47d8c 100644 --- a/pom.xml +++ b/pom.xml @@ -8,7 +8,7 @@ bitbucket-pullrequest-builder Bitbucket Pullrequest Builder Plugin - 1.4.20 + 1.4.21-SNAPSHOT This Jenkins plugin builds pull requests from Bitbucket.org and will report the test results. hpi https://wiki.jenkins-ci.org/display/JENKINS/Bitbucket+pullrequest+builder+plugin @@ -17,7 +17,7 @@ scm:git:ssh://git@github.com/jenkinsci/bitbucket-pullrequest-builder-plugin.git scm:git:ssh://git@github.com/jenkinsci/bitbucket-pullrequest-builder-plugin.git https://github.com/jenkinsci/bitbucket-pullrequest-builder-plugin.git - bitbucket-pullrequest-builder-1.4.20 + HEAD -- cgit v1.2.3 From 5efe15818b87854bc527452103d8c27bcf9b9c51 Mon Sep 17 00:00:00 2001 From: Martin Damovsky Date: Mon, 20 Feb 2017 12:32:34 +0100 Subject: Upgrading parent pom org.jenkins-ci.plugins to version 2.11. I failed releasing version 1.4.20 due to outdated parent pom. It tries to upload to maven.jenkins-ci.org which is no longer available Stacktrace: Caused by: org.apache.maven.wagon.providers.http.httpclient.conn.HttpHostConnectException: Connect to maven.jenkins-ci.org:8081 [maven.jenkins-ci.org/199.193.196.24] failed: Operation timed out More details https://wiki.jenkins-ci.org/display/JENKINS/Hosting+Plugins#HostingPlugins-Workingaroundcommonissues --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 0b47d8c..2349bb8 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ org.jenkins-ci.plugins plugin - 1.596.1 + 2.11 bitbucket-pullrequest-builder -- cgit v1.2.3 From 9417295b77c5b1da8dd5454862e2998f0f03ebb1 Mon Sep 17 00:00:00 2001 From: Martin Damovsky Date: Mon, 20 Feb 2017 13:10:36 +0100 Subject: Fixed reported Findbugs issues --- .../BitbucketBuildFilter.java | 17 +++++----- .../BitbucketBuildTrigger.java | 16 +++++++-- .../BitbucketRepository.java | 15 +++++++-- .../bitbucket/ApiClient.java | 12 ++++++- .../bitbucket/Pullrequest.java | 15 +++++++++ .../BitbucketBuildTrigger/config.jelly | 1 + src/main/resources/index.jelly | 1 + src/test/java/BitbucketBuildFilterTest.java | 38 +++++++++++----------- 8 files changed, 81 insertions(+), 34 deletions(-) diff --git a/src/main/java/bitbucketpullrequestbuilder/bitbucketpullrequestbuilder/BitbucketBuildFilter.java b/src/main/java/bitbucketpullrequestbuilder/bitbucketpullrequestbuilder/BitbucketBuildFilter.java index d4173a2..7754106 100644 --- a/src/main/java/bitbucketpullrequestbuilder/bitbucketpullrequestbuilder/BitbucketBuildFilter.java +++ b/src/main/java/bitbucketpullrequestbuilder/bitbucketpullrequestbuilder/BitbucketBuildFilter.java @@ -1,6 +1,5 @@ package bitbucketpullrequestbuilder.bitbucketpullrequestbuilder; -import hudson.model.Action; import java.util.logging.Logger; import java.util.regex.Pattern; import java.util.ArrayList; @@ -114,7 +113,7 @@ class SourceDestFlag extends Filter { class AuthorFlag extends Filter { static final Pattern AUTHOR_MATCHER_RX = Pattern.compile(AUTHOR_RX + BRANCH_FILTER_RX_PART, Pattern.CASE_INSENSITIVE | Pattern.CANON_EQ); - class AuthorFlagImpl extends Filter { + static class AuthorFlagImpl extends Filter { @Override public boolean apply(String filter, BitbucketCause cause) { String selectedRx = filter.startsWith(RX_FILTER_FLAG_SINGLE) ? filter.substring(RX_FILTER_FLAG_SINGLE.length()) : Pattern.quote(filter); @@ -204,30 +203,30 @@ public class BitbucketBuildFilter { return this.currFilter.apply(this.filter, cause); } - public static BitbucketBuildFilter InstanceByString(String filter) { + public static BitbucketBuildFilter instanceByString(String filter) { logger.log(Level.INFO, "Filter instance by filter string"); return new BitbucketBuildFilter(filter); } - static public String FilterFromGitSCMSource(AbstractGitSCMSource gitscm, String defaultFilter) { + static public String filterFromGitSCMSource(AbstractGitSCMSource gitscm, String defaultFilter) { if (gitscm == null) { logger.log(Level.INFO, "Git SCMSource unavailable. Using default value: {0}", defaultFilter); return defaultFilter; } - String filter = defaultFilter; + StringBuffer filter = new StringBuffer(defaultFilter); final String includes = gitscm.getIncludes(); if (includes != null && !includes.isEmpty()) { for(String part : includes.split("\\s+")) { - filter += String.format("%s ", part.replaceAll("\\*\\/", "d:")); + filter.append(String.format("%s ", part.replaceAll("\\*\\/", "d:"))); } } logger.log(Level.INFO, "Git includes transformation to filter result: {1} -> {0}; default: {2}", new Object[]{ filter, includes, defaultFilter }); - return filter.trim(); + return filter.toString().trim(); } - public static BitbucketBuildFilter InstanceBySCM(Collection scmSources, String defaultFilter) { + public static BitbucketBuildFilter instanceBySCM(Collection scmSources, String defaultFilter) { logger.log(Level.INFO, "Filter instance by using SCMSources list with {0} items", scmSources.size()); AbstractGitSCMSource gitscm = null; for(SCMSource scm : scmSources) { @@ -237,6 +236,6 @@ public class BitbucketBuildFilter { break; } } - return new BitbucketBuildFilter(FilterFromGitSCMSource(gitscm, defaultFilter)); + return new BitbucketBuildFilter(filterFromGitSCMSource(gitscm, defaultFilter)); } } diff --git a/src/main/java/bitbucketpullrequestbuilder/bitbucketpullrequestbuilder/BitbucketBuildTrigger.java b/src/main/java/bitbucketpullrequestbuilder/bitbucketpullrequestbuilder/BitbucketBuildTrigger.java index 846ecb5..40bc215 100644 --- a/src/main/java/bitbucketpullrequestbuilder/bitbucketpullrequestbuilder/BitbucketBuildTrigger.java +++ b/src/main/java/bitbucketpullrequestbuilder/bitbucketpullrequestbuilder/BitbucketBuildTrigger.java @@ -202,7 +202,7 @@ public class BitbucketBuildTrigger extends Trigger> { private void cancelPreviousJobsInQueueThatMatch(@Nonnull BitbucketCause bitbucketCause) { logger.fine("Looking for queued jobs that match PR ID: " + bitbucketCause.getPullRequestId()); - Queue queue = Jenkins.getInstance().getQueue(); + Queue queue = getInstance().getQueue(); for (Queue.Item item : queue.getItems()) { if (hasCauseFromTheSamePullRequest(item.getCauses(), bitbucketCause)) { logger.info("Canceling item in queue: " + item); @@ -211,6 +211,14 @@ public class BitbucketBuildTrigger extends Trigger> { } } + private Jenkins getInstance() { + final Jenkins instance = Jenkins.getInstance(); + if (instance == null){ + throw new IllegalStateException("Jenkins instance is NULL!"); + } + return instance; + } + private void abortRunningJobsThatMatch(@Nonnull BitbucketCause bitbucketCause) { logger.fine("Looking for running jobs that match PR ID: " + bitbucketCause.getPullRequestId()); for (Object o : job.getBuilds()) { @@ -218,7 +226,11 @@ public class BitbucketBuildTrigger extends Trigger> { Build build = (Build) o; if (build.isBuilding() && hasCauseFromTheSamePullRequest(build.getCauses(), bitbucketCause)) { logger.info("Aborting build: " + build + " since PR is outdated"); - build.getExecutor().interrupt(Result.ABORTED); + final Executor executor = build.getExecutor(); + if (executor == null){ + throw new IllegalStateException("Executor can't be NULL"); + } + executor.interrupt(Result.ABORTED); } } } diff --git a/src/main/java/bitbucketpullrequestbuilder/bitbucketpullrequestbuilder/BitbucketRepository.java b/src/main/java/bitbucketpullrequestbuilder/bitbucketpullrequestbuilder/BitbucketRepository.java index 660ec21..570a852 100644 --- a/src/main/java/bitbucketpullrequestbuilder/bitbucketpullrequestbuilder/BitbucketRepository.java +++ b/src/main/java/bitbucketpullrequestbuilder/bitbucketpullrequestbuilder/BitbucketRepository.java @@ -120,11 +120,20 @@ public class BitbucketRepository { pullRequest.getDestination().getCommit().getHash(), pullRequest.getAuthor().getCombinedUsername() ); - setBuildStatus(cause, BuildState.INPROGRESS, Jenkins.getInstance().getRootUrl()); + setBuildStatus(cause, BuildState.INPROGRESS, getInstance().getRootUrl()); this.builder.getTrigger().startJob(cause); } } + private Jenkins getInstance() { + final Jenkins instance = Jenkins.getInstance(); + if (instance == null){ + throw new IllegalStateException("Jenkins instance is NULL!"); + } + return instance; + } + + public void setBuildStatus(BitbucketCause cause, BuildState state, String buildUrl) { String comment = null; String sourceCommit = cause.getSourceCommitHash(); @@ -295,8 +304,8 @@ public class BitbucketRepository { sources.add(src); BitbucketBuildFilter filter = !this.trigger.getBranchesFilterBySCMIncludes() ? - BitbucketBuildFilter.InstanceByString(this.trigger.getBranchesFilter()) : - BitbucketBuildFilter.InstanceBySCM(sources, this.trigger.getBranchesFilter()); + BitbucketBuildFilter.instanceByString(this.trigger.getBranchesFilter()) : + BitbucketBuildFilter.instanceBySCM(sources, this.trigger.getBranchesFilter()); return filter.approved(cause); } diff --git a/src/main/java/bitbucketpullrequestbuilder/bitbucketpullrequestbuilder/bitbucket/ApiClient.java b/src/main/java/bitbucketpullrequestbuilder/bitbucketpullrequestbuilder/bitbucket/ApiClient.java index 0c87478..7ab69c4 100644 --- a/src/main/java/bitbucketpullrequestbuilder/bitbucketpullrequestbuilder/bitbucket/ApiClient.java +++ b/src/main/java/bitbucketpullrequestbuilder/bitbucketpullrequestbuilder/bitbucket/ApiClient.java @@ -58,7 +58,7 @@ public class ApiClient { if (Jenkins.getInstance() == null) return client; - ProxyConfiguration proxy = Jenkins.getInstance().proxy; + ProxyConfiguration proxy = getInstance().proxy; if (proxy == null) return client; logger.log(Level.INFO, "Jenkins proxy: {0}:{1}", new Object[]{ proxy.name, proxy.port }); @@ -75,7 +75,17 @@ public class ApiClient { return client; } + + private Jenkins getInstance() { + final Jenkins instance = Jenkins.getInstance(); + if (instance == null){ + throw new IllegalStateException("Jenkins instance is NULL!"); + } + return instance; + } } + + public ApiClient( String username, String password, diff --git a/src/main/java/bitbucketpullrequestbuilder/bitbucketpullrequestbuilder/bitbucket/Pullrequest.java b/src/main/java/bitbucketpullrequestbuilder/bitbucketpullrequestbuilder/bitbucket/Pullrequest.java index 25755a4..e86d88d 100644 --- a/src/main/java/bitbucketpullrequestbuilder/bitbucketpullrequestbuilder/bitbucket/Pullrequest.java +++ b/src/main/java/bitbucketpullrequestbuilder/bitbucketpullrequestbuilder/bitbucket/Pullrequest.java @@ -199,6 +199,21 @@ public class Pullrequest { } } + @Override + public boolean equals(final Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + + final Comment comment = (Comment) o; + + return getId() != null ? getId().equals(comment.getId()) : comment.getId() == null; + } + + @Override + public int hashCode() { + return getId() != null ? getId().hashCode() : 0; + } + @JsonProperty("comment_id") public Integer getId() { return id; diff --git a/src/main/resources/bitbucketpullrequestbuilder/bitbucketpullrequestbuilder/BitbucketBuildTrigger/config.jelly b/src/main/resources/bitbucketpullrequestbuilder/bitbucketpullrequestbuilder/BitbucketBuildTrigger/config.jelly index 971954f..f79c601 100644 --- a/src/main/resources/bitbucketpullrequestbuilder/bitbucketpullrequestbuilder/BitbucketBuildTrigger/config.jelly +++ b/src/main/resources/bitbucketpullrequestbuilder/bitbucketpullrequestbuilder/BitbucketBuildTrigger/config.jelly @@ -1,3 +1,4 @@ + diff --git a/src/main/resources/index.jelly b/src/main/resources/index.jelly index 0404451..372d9f8 100644 --- a/src/main/resources/index.jelly +++ b/src/main/resources/index.jelly @@ -1,3 +1,4 @@ + diff --git a/src/test/java/BitbucketBuildFilterTest.java b/src/test/java/BitbucketBuildFilterTest.java index 3a94c82..21b4a01 100644 --- a/src/test/java/BitbucketBuildFilterTest.java +++ b/src/test/java/BitbucketBuildFilterTest.java @@ -45,12 +45,12 @@ public class BitbucketBuildFilterTest { EasyMock.replay(cause); for(String f : new String[] {"", "*", "any"}) { - BitbucketBuildFilter filter = BitbucketBuildFilter.InstanceByString(f); + BitbucketBuildFilter filter = BitbucketBuildFilter.instanceByString(f); assertTrue(filter.approved(cause)); } for(String f : new String[] {"foo", "bar", " baz "}) { - BitbucketBuildFilter filter = BitbucketBuildFilter.InstanceByString(f); + BitbucketBuildFilter filter = BitbucketBuildFilter.instanceByString(f); assertFalse(filter.approved(cause)); } } @@ -63,12 +63,12 @@ public class BitbucketBuildFilterTest { EasyMock.replay(cause); for(String f : new String[] {"master-branch", "r:^master", "r:branch$", " master-branch "}) { - BitbucketBuildFilter filter = BitbucketBuildFilter.InstanceByString(f); + BitbucketBuildFilter filter = BitbucketBuildFilter.instanceByString(f); assertTrue(filter.approved(cause)); } for(String f : new String[] {"develop", "feature-good-thing", "r:develop$"}) { - BitbucketBuildFilter filter = BitbucketBuildFilter.InstanceByString(f); + BitbucketBuildFilter filter = BitbucketBuildFilter.instanceByString(f); assertFalse(filter.approved(cause)); } } @@ -92,12 +92,12 @@ public class BitbucketBuildFilterTest { EasyMock.replay(cause); for(String f : new String[] {"s:feature-for-master d:master", "s:r:^feature d:master", "s:feature-for-master d:r:^m", "s:r:^feature d:r:^master"}) { - BitbucketBuildFilter filter = BitbucketBuildFilter.InstanceByString(f); + BitbucketBuildFilter filter = BitbucketBuildFilter.instanceByString(f); assertTrue(filter.approved(cause)); } for(String f : new String[] {"s:feature-for-master d:foo", "s:bar d:master", "s:foo d:bar"}) { - BitbucketBuildFilter filter = BitbucketBuildFilter.InstanceByString(f); + BitbucketBuildFilter filter = BitbucketBuildFilter.instanceByString(f); assertFalse(filter.approved(cause)); } } @@ -111,12 +111,12 @@ public class BitbucketBuildFilterTest { EasyMock.replay(cause); for(String f : new String[] {"s: d:", "s:r:^feature s:good-branch d:r:.*", "s:good-branch s:feature-master d:r:.*", "s: d:r:.*", "d:master d:foo d:bar s:"}) { - BitbucketBuildFilter filter = BitbucketBuildFilter.InstanceByString(f); + BitbucketBuildFilter filter = BitbucketBuildFilter.instanceByString(f); assertTrue(filter.approved(cause)); } for(String f : new String[] {"d:ggg d:ooo d:333 s:feature-master", "s:111 s:222 s:333 d:master"}) { - BitbucketBuildFilter filter = BitbucketBuildFilter.InstanceByString(f); + BitbucketBuildFilter filter = BitbucketBuildFilter.instanceByString(f); assertFalse(filter.approved(cause)); } } @@ -130,12 +130,12 @@ public class BitbucketBuildFilterTest { EasyMock.replay(cause); for(String f : new String[] {"s:feature-master d:", "d:master s:"}) { - BitbucketBuildFilter filter = BitbucketBuildFilter.InstanceByString(f); + BitbucketBuildFilter filter = BitbucketBuildFilter.instanceByString(f); assertTrue(filter.approved(cause)); } for(String f : new String[] {"s:feature-master", "d:master"}) { - BitbucketBuildFilter filter = BitbucketBuildFilter.InstanceByString(f); + BitbucketBuildFilter filter = BitbucketBuildFilter.instanceByString(f); assertFalse(filter.approved(cause)); } } @@ -150,12 +150,12 @@ public class BitbucketBuildFilterTest { EasyMock.replay(cause); for(String f : new String[] {"a:test", "a:r:^test", "d: s: a:", "a:", "a:foo a:test"}) { - BitbucketBuildFilter filter = BitbucketBuildFilter.InstanceByString(f); + BitbucketBuildFilter filter = BitbucketBuildFilter.instanceByString(f); assertTrue(filter.approved(cause)); } for(String f : new String[] {"s:feature-master", "d:master", "s:feature-master d: a:foo", "a:bar"}) { - BitbucketBuildFilter filter = BitbucketBuildFilter.InstanceByString(f); + BitbucketBuildFilter filter = BitbucketBuildFilter.instanceByString(f); assertFalse(filter.approved(cause)); } } @@ -167,11 +167,11 @@ public class BitbucketBuildFilterTest { EasyMock.expect(cause.getTargetBranch()).andReturn("master").anyTimes(); EasyMock.replay(cause); - assertTrue(BitbucketBuildFilter.FilterFromGitSCMSource(null, "").isEmpty()); - assertEquals("default", BitbucketBuildFilter.FilterFromGitSCMSource(null, "default")); + assertTrue(BitbucketBuildFilter.filterFromGitSCMSource(null, "").isEmpty()); + assertEquals("default", BitbucketBuildFilter.filterFromGitSCMSource(null, "default")); - assertTrue(BitbucketBuildFilter.InstanceByString( - BitbucketBuildFilter.FilterFromGitSCMSource(null, "")).approved(cause) + assertTrue(BitbucketBuildFilter.instanceByString( + BitbucketBuildFilter.filterFromGitSCMSource(null, "")).approved(cause) ); } @@ -187,9 +187,9 @@ public class BitbucketBuildFilterTest { EasyMock.replay(git); assertTrue(git.getIncludes().isEmpty()); - assertEquals("", BitbucketBuildFilter.FilterFromGitSCMSource(git, "")); - assertEquals("d:master d:feature-branch", BitbucketBuildFilter.FilterFromGitSCMSource(git, "")); - assertEquals("d:master", BitbucketBuildFilter.FilterFromGitSCMSource(git, "")); + assertEquals("", BitbucketBuildFilter.filterFromGitSCMSource(git, "")); + assertEquals("d:master d:feature-branch", BitbucketBuildFilter.filterFromGitSCMSource(git, "")); + assertEquals("d:master", BitbucketBuildFilter.filterFromGitSCMSource(git, "")); } @Test -- cgit v1.2.3 From 7d9acfb5676353d266fdfb59a8ae68b61645cfc5 Mon Sep 17 00:00:00 2001 From: Martin Damovsky Date: Mon, 20 Feb 2017 13:16:54 +0100 Subject: [maven-release-plugin] prepare release bitbucket-pullrequest-builder-1.4.21 --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 2349bb8..aca4166 100644 --- a/pom.xml +++ b/pom.xml @@ -8,7 +8,7 @@ bitbucket-pullrequest-builder Bitbucket Pullrequest Builder Plugin - 1.4.21-SNAPSHOT + 1.4.21 This Jenkins plugin builds pull requests from Bitbucket.org and will report the test results. hpi https://wiki.jenkins-ci.org/display/JENKINS/Bitbucket+pullrequest+builder+plugin @@ -17,7 +17,7 @@ scm:git:ssh://git@github.com/jenkinsci/bitbucket-pullrequest-builder-plugin.git scm:git:ssh://git@github.com/jenkinsci/bitbucket-pullrequest-builder-plugin.git https://github.com/jenkinsci/bitbucket-pullrequest-builder-plugin.git - HEAD + bitbucket-pullrequest-builder-1.4.21 -- cgit v1.2.3 From 8717b231004ce0f4446d02e1506111b4ec13f86a Mon Sep 17 00:00:00 2001 From: Martin Damovsky Date: Mon, 20 Feb 2017 13:17:01 +0100 Subject: [maven-release-plugin] prepare for next development iteration --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index aca4166..a0fdd11 100644 --- a/pom.xml +++ b/pom.xml @@ -8,7 +8,7 @@ bitbucket-pullrequest-builder Bitbucket Pullrequest Builder Plugin - 1.4.21 + 1.4.22-SNAPSHOT This Jenkins plugin builds pull requests from Bitbucket.org and will report the test results. hpi https://wiki.jenkins-ci.org/display/JENKINS/Bitbucket+pullrequest+builder+plugin @@ -17,7 +17,7 @@ scm:git:ssh://git@github.com/jenkinsci/bitbucket-pullrequest-builder-plugin.git scm:git:ssh://git@github.com/jenkinsci/bitbucket-pullrequest-builder-plugin.git https://github.com/jenkinsci/bitbucket-pullrequest-builder-plugin.git - bitbucket-pullrequest-builder-1.4.21 + HEAD -- cgit v1.2.3 From f8a81c59af12383315ab5c75c94d1f9eb3a5a8bc Mon Sep 17 00:00:00 2001 From: Martin Damovsky Date: Wed, 22 Feb 2017 22:55:10 +0100 Subject: Fixed bug in PullRequest - NPE see https://github.com/nishio-dens/bitbucket-pullrequest-builder-plugin/issues/110 --- .../bitbucketpullrequestbuilder/bitbucket/Pullrequest.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/java/bitbucketpullrequestbuilder/bitbucketpullrequestbuilder/bitbucket/Pullrequest.java b/src/main/java/bitbucketpullrequestbuilder/bitbucketpullrequestbuilder/bitbucket/Pullrequest.java index e86d88d..5cf1fa7 100644 --- a/src/main/java/bitbucketpullrequestbuilder/bitbucketpullrequestbuilder/bitbucket/Pullrequest.java +++ b/src/main/java/bitbucketpullrequestbuilder/bitbucketpullrequestbuilder/bitbucket/Pullrequest.java @@ -189,8 +189,11 @@ public class Pullrequest { private String updatedOn; private String createdOn; + @Override public int compareTo(Comment target) { - if (this.getId() > target.getId()) { + if (target == null){ + return -1; + } else if (this.getId() > target.getId()) { return 1; } else if (this.getId().equals(target.getId())) { return 0; -- cgit v1.2.3