Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

version 1.4.21 is not working. #110

Closed
chrisLeeTW opened this issue Feb 22, 2017 · 10 comments
Closed

version 1.4.21 is not working. #110

chrisLeeTW opened this issue Feb 22, 2017 · 10 comments
Assignees

Comments

@chrisLeeTW
Copy link
Contributor

as title, continue see the error in jenkins log.
and no build job is triggered.

Feb 22, 2017 3:17:02 PM hudson.triggers.Trigger checkTriggers
WARNING: bitbucketpullrequestbuilder.bitbucketpullrequestbuilder.BitbucketBuildTrigger.run() failed for hudson.model.FreeStyleProject@4d66e4f8[_hide_cnyes-commit-build]
java.lang.NullPointerException
at bitbucketpullrequestbuilder.bitbucketpullrequestbuilder.bitbucket.Pullrequest$Comment.compareTo(Pullrequest.java:193)
at bitbucketpullrequestbuilder.bitbucketpullrequestbuilder.bitbucket.Pullrequest$Comment.compareTo(Pullrequest.java:184)
at java.util.ComparableTimSort.countRunAndMakeAscending(ComparableTimSort.java:290)
at java.util.ComparableTimSort.sort(ComparableTimSort.java:157)
at java.util.ComparableTimSort.sort(ComparableTimSort.java:146)
at java.util.Arrays.sort(Arrays.java:472)
at java.util.Collections.sort(Collections.java:155)
at bitbucketpullrequestbuilder.bitbucketpullrequestbuilder.BitbucketRepository.filterPullRequestComments(BitbucketRepository.java:204)
at bitbucketpullrequestbuilder.bitbucketpullrequestbuilder.BitbucketRepository.isBuildTarget(BitbucketRepository.java:246)
at bitbucketpullrequestbuilder.bitbucketpullrequestbuilder.BitbucketRepository.getTargetPullRequests(BitbucketRepository.java:94)
at bitbucketpullrequestbuilder.bitbucketpullrequestbuilder.BitbucketPullRequestsBuilder.run(BitbucketPullRequestsBuilder.java:37)
at bitbucketpullrequestbuilder.bitbucketpullrequestbuilder.BitbucketBuildTrigger.run(BitbucketBuildTrigger.java:272)
at hudson.triggers.Trigger.checkTriggers(Trigger.java:278)
at hudson.triggers.Trigger$Cron.doRun(Trigger.java:226)
at hudson.triggers.SafeTimerTask.run(SafeTimerTask.java:50)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:304)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:178)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)

@randy-ja
Copy link

I'm seeing the same issue

@damovsky
Copy link
Collaborator

is this a new issue or was it failing also in previous versions?

@randy-ja
Copy link

randy-ja commented Feb 22, 2017

It was failing previously but triggering builds over and over (beginning on 2/10). Before that everything was working just fine. I had turned off my Jenkins builds until I saw the release of 1.4.21 came out. After upgrading to 1.4.21 and enabling the build I'm seeing these NPEs every time the plugin checks for pull requests. It seems when trying to sort the comments, one of the entries in the collection is null. Might be able to get around this with a null check inside the compareTo?

@damovsky
Copy link
Collaborator

@randy-ja I will check and try to fix is as soon as possible. Thanks for info!

damovsky added a commit to jenkinsci/bitbucket-pullrequest-builder-plugin that referenced this issue Feb 22, 2017
@damovsky
Copy link
Collaborator

@randy-ja I have a fix on pull request...you can expect a new release within hours

@damovsky
Copy link
Collaborator

fixed in version 1.4.23
(version 1.4.24 does not contains the fix - my mistake during release procedure).

The release version should appears in jenkins update center within hours (they say it can take up to 8 hours)

@damovsky damovsky self-assigned this Feb 22, 2017
@randy-ja
Copy link

randy-ja commented Feb 23, 2017

I'm still getting a NullPointerException @ this.getId() > target.getId() after updating to 1.4.23.

WARNING: bitbucketpullrequestbuilder.bitbucketpullrequestbuilder.BitbucketBuildTrigger.run() failed for hudson.model.FreeStyleProject@6bdebf9d[Platform-Dev-PullRequest] java.lang.NullPointerException at bitbucketpullrequestbuilder.bitbucketpullrequestbuilder.bitbucket.Pullrequest$Comment.compareTo(Pullrequest.java:196) at bitbucketpullrequestbuilder.bitbucketpullrequestbuilder.bitbucket.Pullrequest$Comment.compareTo(Pullrequest.java:184) at java.util.ComparableTimSort.countRunAndMakeAscending(ComparableTimSort.java:290) at java.util.ComparableTimSort.sort(ComparableTimSort.java:157) at java.util.ComparableTimSort.sort(ComparableTimSort.java:146) at java.util.Arrays.sort(Arrays.java:472) at java.util.Collections.sort(Collections.java:155) at bitbucketpullrequestbuilder.bitbucketpullrequestbuilder.BitbucketRepository.filterPullRequestComments(BitbucketRepository.java:204) at bitbucketpullrequestbuilder.bitbucketpullrequestbuilder.BitbucketRepository.isBuildTarget(BitbucketRepository.java:246) at bitbucketpullrequestbuilder.bitbucketpullrequestbuilder.BitbucketRepository.getTargetPullRequests(BitbucketRepository.java:94) at bitbucketpullrequestbuilder.bitbucketpullrequestbuilder.BitbucketPullRequestsBuilder.run(BitbucketPullRequestsBuilder.java:37) at bitbucketpullrequestbuilder.bitbucketpullrequestbuilder.BitbucketBuildTrigger.run(BitbucketBuildTrigger.java:272) at hudson.triggers.Trigger.checkTriggers(Trigger.java:272) at hudson.triggers.Trigger$Cron.doRun(Trigger.java:221) at hudson.triggers.SafeTimerTask.run(SafeTimerTask.java:50) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:304) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:178) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:744)

I just realized that the issue is that the two Integer objects are being compared using > .

The pattern I tend to use is: (not sure why this won't format correctly)
`public int compareTo(Comment target) {
//following the contract of compareTo, if the target is null a NullPointerException should be thrown
if(target == null) {
throw new NullPointerException();
}

        //if either id is null, find which is null and return -1 or 1 accordingly
        if(this.getId() == null ^ target.getId() == null) {
            return this.getId() == null ? -1 : 1;
        }
        
        //if both values are null, return 0
        if(this.getId() == null && target.getId() == null) {
            return 0;
        }
        
        //if both have values, call Integer.compareTo
        return this.getId().compareTo(target.getId());
        
    }`

@damovsky
Copy link
Collaborator

@randy-ja today I noticed the problem on my own jenkins instance...so I debug it and found a reason - there was a problem with JSON mapping - id was always null, see jenkinsci@524bafb

I fixed it and release it as 1.4.24

@randy-ja
Copy link

Upgraded to 1.4.24 and working now, thanks!

@paustin01
Copy link

paustin01 commented Feb 23, 2017

Confirmed! Thanks for the quick resolution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants