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

Pull request cannot be merged (NullPointerException) #59

Closed
pgarciafc opened this issue Dec 2, 2016 · 8 comments
Closed

Pull request cannot be merged (NullPointerException) #59

pgarciafc opened this issue Dec 2, 2016 · 8 comments

Comments

@pgarciafc
Copy link

Hi,

I recently upgraded my corporate Bitbucket Server instance from version 4.7.1 to 4.11.1. At the same time, I updated the plugin from 2.3.1 to 2.3.3.

This produces the following error when trying to merge a pull request:

2016-12-02 04:28:11,097 WARN [http-nio-127.0.0.1-7990-exec-4] johndoe @PJWD6Ex268x93315x3 wuxacp 10.102.33.146,10.160.8.62,127.0.0.1 "GET /rest/api/latest/projects/PROJECT1/repos/repository1/pull-requests/99/merge HTTP/1.1" c.a.s.i.p.DefaultMergeRequestCheckService Merge request check com.monitorjbl.plugins.pr-harmony:mergeCheck of type com.monitorjbl.plugins.MergeBlocker failed. java.lang.NullPointerException: null at com.monitorjbl.plugins.MergeBlocker.check(MergeBlocker.java:43) ~[na:na] at com.atlassian.stash.internal.pull.DefaultMergeRequestCheckService.doCheck(DefaultMergeRequestCheckService.java:74) [bitbucket-service-impl-4.11.1.jar:na] at com.atlassian.stash.internal.pull.DefaultMergeRequestCheckService.checkMergeability(DefaultMergeRequestCheckService.java:55) [bitbucket-service-impl-4.11.1.jar:na] at com.atlassian.stash.internal.pull.DefaultPullRequestService.canMerge(DefaultPullRequestService.java:349) [bitbucket-service-impl-4.11.1.jar:na] at com.atlassian.plugin.util.ContextClassLoaderSettingInvocationHandler.invoke(ContextClassLoaderSettingInvocationHandler.java:26) [atlassian-plugins-core-4.2.4.jar:na] at org.eclipse.gemini.blueprint.service.importer.support.internal.aop.ServiceInvoker.doInvoke(ServiceInvoker.java:56) [gemini-blueprint-core-2.0.0.BUILD-atlassian-m002.jar:2.0.0.BUILD-atlassian-m002] at org.eclipse.gemini.blueprint.service.importer.support.internal.aop.ServiceInvoker.invoke(ServiceInvoker.java:60) [gemini-blueprint-core-2.0.0.BUILD-atlassian-m002.jar:2.0.0.BUILD-atlassian-m002] at org.eclipse.gemini.blueprint.service.util.internal.aop.ServiceTCCLInterceptor.invokeUnprivileged(ServiceTCCLInterceptor.java:70) [gemini-blueprint-core-2.0.0.BUILD-atlassian-m002.jar:2.0.0.BUILD-atlassian-m002] at org.eclipse.gemini.blueprint.service.util.internal.aop.ServiceTCCLInterceptor.invoke(ServiceTCCLInterceptor.java:53) [gemini-blueprint-core-2.0.0.BUILD-atlassian-m002.jar:2.0.0.BUILD-atlassian-m002] at org.eclipse.gemini.blueprint.service.importer.support.LocalBundleContextAdvice.invoke(LocalBundleContextAdvice.java:57) [gemini-blueprint-core-2.0.0.BUILD-atlassian-m002.jar:2.0.0.BUILD-atlassian-m002] at com.atlassian.stash.internal.rest.pull.PullRequestResource.canMerge(PullRequestResource.java:427) [bitbucket-rest-4.11.1.jar:na] at com.atlassian.applinks.core.rest.context.ContextFilter.doFilter(ContextFilter.java:24) [applinks-plugin-5.2.4_1479334904000.jar:na] at com.atlassian.applinks.core.rest.context.ContextFilter.doFilter(ContextFilter.java:24) [applinks-plugin-5.2.4_1479334904000.jar:na] at com.atlassian.applinks.core.rest.context.ContextFilter.doFilter(ContextFilter.java:24) [applinks-plugin-5.2.4_1479334904000.jar:na] at com.atlassian.applinks.core.rest.context.ContextFilter.doFilter(ContextFilter.java:24) [applinks-plugin-5.2.4_1479334904000.jar:na] at com.atlassian.applinks.core.rest.context.ContextFilter.doFilter(ContextFilter.java:24) [applinks-plugin-5.2.4_1479334904000.jar:na] at com.atlassian.analytics.client.filter.UniversalAnalyticsFilter.doFilter(UniversalAnalyticsFilter.java:92) [analytics-client-5.2.20_1479338804000.jar:na] at com.atlassian.analytics.client.filter.AbstractHttpFilter.doFilter(AbstractHttpFilter.java:39) [analytics-client-5.2.20_1479338804000.jar:na] at com.atlassian.plugin.connect.plugin.auth.scope.ApiScopingFilter.doFilter(ApiScopingFilter.java:81) [atlassian-connect-plugin-1.1.86-bitbucket-04.jar:na] at com.atlassian.stash.internal.spring.security.StashAuthenticationFilter.doFilter(StashAuthenticationFilter.java:88) [classes/:na] at com.atlassian.stash.internal.web.auth.BeforeLoginPluginAuthenticationFilter.doInsideSpringSecurityChain(BeforeLoginPluginAuthenticationFilter.java:109) [classes/:na] at com.atlassian.stash.internal.web.auth.BeforeLoginPluginAuthenticationFilter.doFilter(BeforeLoginPluginAuthenticationFilter.java:75) [classes/:na] at com.atlassian.security.auth.trustedapps.filter.TrustedApplicationsFilter.doFilter(TrustedApplicationsFilter.java:94) [atlassian-trusted-apps-core-4.2.0.jar:na] at com.atlassian.oauth.serviceprovider.internal.servlet.OAuthFilter.doFilter(OAuthFilter.java:67) [atlassian-oauth-service-provider-plugin-2.0.3_1479338806000.jar:na] at com.atlassian.core.filters.ServletContextThreadLocalFilter.doFilter(ServletContextThreadLocalFilter.java:21) [atlassian-core-4.6.19.jar:na] at com.atlassian.core.filters.AbstractHttpFilter.doFilter(AbstractHttpFilter.java:31) [atlassian-core-4.6.19.jar:na] at com.atlassian.plugin.connect.plugin.auth.user.ThreeLeggedAuthFilter.doFilter(ThreeLeggedAuthFilter.java:109) [atlassian-connect-plugin-1.1.86-bitbucket-04.jar:na] at com.atlassian.jwt.internal.servlet.JwtAuthFilter.doFilter(JwtAuthFilter.java:32) [jwt-plugin-1.5.11-0002_1479338804000.jar:na] at com.atlassian.analytics.client.filter.DefaultAnalyticsFilter.doFilter(DefaultAnalyticsFilter.java:38) [analytics-client-5.2.20_1479338804000.jar:na] at com.atlassian.analytics.client.filter.AbstractHttpFilter.doFilter(AbstractHttpFilter.java:39) [analytics-client-5.2.20_1479338804000.jar:na] at com.atlassian.stash.internal.web.auth.BeforeLoginPluginAuthenticationFilter.doBeforeBeforeLoginFilters(BeforeLoginPluginAuthenticationFilter.java:87) [classes/:na] at com.atlassian.stash.internal.web.auth.BeforeLoginPluginAuthenticationFilter.doFilter(BeforeLoginPluginAuthenticationFilter.java:73) [classes/:na] at com.atlassian.stash.internal.request.DefaultRequestManager.doAsRequest(DefaultRequestManager.java:86) ~[bitbucket-service-impl-4.11.1.jar:na] at com.atlassian.stash.internal.hazelcast.ConfigurableWebFilter.doFilter(ConfigurableWebFilter.java:38) ~[classes/:na] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) ~[na:1.8.0_74] at java.lang.Thread.run(Thread.java:745) ~[na:1.8.0_74] ... 303 frames trimmed

If I go to the PR Harmony configuration within the project, set any random value to any of the fields, and Save, then Bitbucket allows me to merge.

Downgrading to version 3.2.1 fixed the issue permanently.

Thanks,

@monitorjbl
Copy link
Owner

Can you try checking the Needs Work button and clicking save? I think it's because the field is null and there's no value set so the Java unboxing is causing an NPE. It's definitely a bug, but this will confirm what's causing it.

@strmaks
Copy link

strmaks commented Dec 5, 2016

I have a similar problem on my BitBucket Server 4.11.2 and yes, setting "Block merge if pull request needs work" checkbox and saving settings fix this problem.

@pgarciafc
Copy link
Author

Sorry for the late reply. I was on vacation.

One reviewer has clicked in "Needs work" (Don't know exactly where is that 'Save' button) but Bitbucket still doesn't allow me to merge.

@pgarciafc
Copy link
Author

Okay, I just read @strmaks comment. Yes, checking that box and clicking Save works. I could merge it afterwards :) Sorry.

@kenjiqq
Copy link

kenjiqq commented Jan 4, 2017

Just adding that we also experienced the issue and had to downgrade because it blocked merging for other projects too that didn't use any of the plugin features

@mnhorak
Copy link

mnhorak commented Jan 4, 2017

On Bitbucket Server v4.10.0, the merge button was disabled and the hover text showed the following message:

The merge check com.monitorjbl.plugins.pr-harmony failed due to an unexpected error. Please contact your system administrator for help.

The same Null Pointer Exception as @pgarciafc is seen in the logs. Updating the PR Harmony settings (i.e. checking "Block merge if pull request needs work" and saving) re-enabled the merge.

@monitorjbl
Copy link
Owner

I pushed a fix for this just now to the marketplace as version 2.3.4. Sorry for the delay, it was a simple fix but the holidays kinda killed all my free time for a while.

I think most of the folks reporting the issue are going to be unable to test it after doing the workaround. The root cause was that the Needs Work flag is null after upgrading from 2.3.2 to 2.3.3. If you make any config changes to PR Harmony, the flag is set to false (or true if you ticked the box) and the problem goes away. I'm going to ahead and mark it closed for now, but if anyone else runs across this, please let me know!

@monitorjbl
Copy link
Owner

Turns out its in 2.3.5 instead, accidentally missed an issue caused by #58 checking the participants instead of reviewers in 2.3.4. Sorry about that!

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

5 participants