Linky blows up on pull requests that don't have an author

Issue #40 resolved
Erik van Zijst created an issue

Some pull requests that are returned by the Bitbucket Pull Request Links addon don't have an author because the account that created the pr has since been deleted.

An example is this pr:

https://api-io-staging.bb-inf.net/addons/org.bitbucket.prlinks/bitbucket/1.0/repositories/%7B%7D/%7B673a6070-3421-46c9-9d48-90745f7bfe8e%7D/commits/8d102600ce2144d8448d49f194c8d568328deed7/pullrequests?fields=author.links.avatar.href,author.display_name,links.html.href,id,title,state

The plugin does not handle this scenario well and blows up:

IDE Fatal Errors 2017-11-13 16-33-26.png

With the following stack trace:

Failed to fetch related Pull Requests from BitbucketCloud(id=700bf14e-64d5-4dda-a595-79811c4e5cee, baseUri=https://staging.bb-inf.net/)
java.lang.Throwable
    at com.intellij.openapi.diagnostic.Logger.error(Logger.java:132)
    at com.atlassian.bitbucket.linky.actions.prlinks.FindCommitRelatedPullRequestsAction.showError(commit-pull-requests.kt:160)
    at com.atlassian.bitbucket.linky.actions.prlinks.FindCommitRelatedPullRequestsAction.access$showError(commit-pull-requests.kt:41)
    at com.atlassian.bitbucket.linky.actions.prlinks.FindCommitRelatedPullRequestsAction$showPullRequestsForCommit$1$2$1$1$1.doResume(commit-pull-requests.kt:98)
    at kotlin.coroutines.experimental.jvm.internal.CoroutineImpl.resume(CoroutineImpl.kt:54)
    at kotlin.coroutines.experimental.jvm.internal.CoroutineImpl.resume(CoroutineImpl.kt:53)
    at kotlin.coroutines.experimental.jvm.internal.CoroutineImpl.resumeWithException(CoroutineImpl.kt:59)
    at kotlinx.coroutines.experimental.DispatchTask.run(CoroutineDispatcher.kt:122)
    at java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1402)
    at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
    at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
    at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
    at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)

Comments (5)

  1. Daniil Penkin staff

    =) Will fix this.

    Just curious, what if a reviewer's account is deleted – will it disappear from reviewers list?

  2. Erik van Zijst reporter

    Yes, it will just disappear. It's more that we didn't want the deletion of a user account to destroy all the data in pull requests and comments and so we're just setting that foreign key to null.

  3. Log in to comment