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

PR decorations not working #243

Closed
yramya20 opened this issue Sep 14, 2020 · 3 comments
Closed

PR decorations not working #243

yramya20 opened this issue Sep 14, 2020 · 3 comments
Labels
bug Something isn't working

Comments

@yramya20
Copy link

yramya20 commented Sep 14, 2020

Hello,

PR decoration with bitbucket server doesnt work due to below error, I'm using sonarqube 7.9 and plugin version 1.3.2.

2020.09.16 01:35:01 DEBUG ce[AXSWDWjMA-QCakI2uefv][c.g.m.s.p.c.p.PullRequestPostAnalysisTask] found 3 pull request decorators
2020.09.16 01:35:01 INFO  ce[AXSWDWjMA-QCakI2uefv][c.g.m.s.p.c.p.PullRequestPostAnalysisTask] using pull request decorator BitbucketServer
2020.09.16 01:35:01 DEBUG ce[AXSWDWjMA-QCakI2uefv][c.g.m.s.p.c.p.b.c.BitbucketServerClient] Your Bitbucket Server installation is version 5.16.1
2020.09.16 01:35:01 ERROR ce[AXSWDWjMA-QCakI2uefv][o.s.c.t.s.ComputationStepExecutor] Execution of listener failed
java.lang.NullPointerException: null
        at java.base/java.util.Collections$UnmodifiableCollection.<init>(Unknown Source)
        at java.base/java.util.Collections$UnmodifiableSet.<init>(Unknown Source)
        at java.base/java.util.Collections.unmodifiableSet(Unknown Source)
        at com.github.mc1arke.sonarqube.plugin.ce.pullrequest.bitbucket.client.model.server.ErrorResponse.getErrors(ErrorResponse.java:35)
        at java.base/java.util.Optional.map(Unknown Source)
        at com.github.mc1arke.sonarqube.plugin.ce.pullrequest.bitbucket.client.BitbucketException.getMessage(BitbucketException.java:44)
        at ch.qos.logback.classic.spi.ThrowableProxy.<init>(ThrowableProxy.java:54)
        at ch.qos.logback.classic.spi.LoggingEvent.<init>(LoggingEvent.java:119)
        at ch.qos.logback.classic.Logger.buildLoggingEventAndAppend(Logger.java:419)
        at ch.qos.logback.classic.Logger.filterAndLog_0_Or3Plus(Logger.java:383)
        at ch.qos.logback.classic.Logger.error(Logger.java:538)
        at org.sonar.api.utils.log.LogbackLogger.doError(LogbackLogger.java:155)
        at org.sonar.api.utils.log.BaseLogger.error(BaseLogger.java:154)
        at org.sonar.ce.task.projectanalysis.api.posttask.PostProjectAnalysisTasksExecutor.executeTask(PostProjectAnalysisTasksExecutor.java:115)
        at org.sonar.ce.task.projectanalysis.api.posttask.PostProjectAnalysisTasksExecutor.finished(PostProjectAnalysisTasksExecutor.java:107)
        at org.sonar.ce.task.step.ComputationStepExecutor.executeListener(ComputationStepExecutor.java:91)
        at org.sonar.ce.task.step.ComputationStepExecutor.execute(ComputationStepExecutor.java:63)
        at org.sonar.ce.task.projectanalysis.taskprocessor.ReportTaskProcessor.process(ReportTaskProcessor.java:81)
        at org.sonar.ce.taskprocessor.CeWorkerImpl$ExecuteTask.executeTask(CeWorkerImpl.java:209)
        at org.sonar.ce.taskprocessor.CeWorkerImpl$ExecuteTask.run(CeWorkerImpl.java:191)
        at org.sonar.ce.taskprocessor.CeWorkerImpl.findAndProcessTask(CeWorkerImpl.java:158)
        at org.sonar.ce.taskprocessor.CeWorkerImpl$TrackRunningState.get(CeWorkerImpl.java:133)
        at org.sonar.ce.taskprocessor.CeWorkerImpl.call(CeWorkerImpl.java:85)
        at org.sonar.ce.taskprocessor.CeWorkerImpl.call(CeWorkerImpl.java:53)
        at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
        at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
        at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
        at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
        at java.base/java.lang.Thread.run(Unknown Source)
@yramya20 yramya20 added the bug Something isn't working label Sep 14, 2020
@yramya20 yramya20 changed the title Run analysis of the PR branch not working PR analysis and decorations not working Sep 14, 2020
@yramya20 yramya20 reopened this Sep 15, 2020
@yramya20 yramya20 changed the title PR analysis and decorations not working PR decorations not working Sep 15, 2020
@mc1arke
Copy link
Owner

mc1arke commented Oct 26, 2020

Does this fail for every attempt at decoration? The NullPointerException is easy to overcome, but it's happening on an exception path anyway, so I suspect your Bitbucket server is returning an error reponse.

@marvin-w Do you have any ideas on this? I'll add a null check around the variable wrapping in getErrors for the next release, but don't know if there's anything more we'd be expecting to pull from the Bitbucket response

@marvin-w
Copy link
Contributor

@mc1arke I would wrap it with a null check. Unfortunately it hides the real error right now. I personally use Bitbucket Cloud and this error only occurs on Bitbucket Server. The Exception will probably stay even after adding a null check, but at least he/we would then be able to identify the root cause.

mc1arke added a commit that referenced this issue Oct 27, 2020
There are situations where Bitbucket server is returning an error during API calls, but has no messages specified in the response body, so is causing a `NullPointerException` to be thrown by the plugin whilst attempting to provide details on the error. Specifically checking for the messages not being present allows for the underlying HTTP status code to be returned in the exception details so the user can get a better understanding of what the issue is.
mc1arke added a commit that referenced this issue Oct 27, 2020
There are situations where Bitbucket server is returning an error during API calls, but has no messages specified in the response body, so is causing a `NullPointerException` to be thrown by the plugin whilst attempting to provide details on the error. Specifically checking for the messages not being present allows for the underlying HTTP status code to be returned in the exception details so the user can get a better understanding of what the issue is.
@mc1arke
Copy link
Owner

mc1arke commented Jan 23, 2021

Closing since there have been no recent replicate details after the logging was updated.

@mc1arke mc1arke closed this as completed Jan 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants