Uploaded image for project: 'Jira Software Data Center'
  1. Jira Software Data Center
  2. JSWSERVER-20932

DVCS bitbucket cloud pull request endpoint fails to parse

    XMLWordPrintable

Details

    Description

      Issue Summary

      Caused by: java.lang.UnsupportedOperationException: JsonObjectCaused by: java.lang.UnsupportedOperationException: JsonObject at com.google.gson.JsonElement.getAsString(JsonElement.java:191) at com.atlassian.jira.plugins.dvcs.spi.bitbucket.clientlibrary.model.repository.pullrequest.BitbucketPullRequestActivityEnvelopeDeserializer.deserialize(BitbucketPullRequestActivityEnvelopeDeserializer.java:46)

      java.lang.UnsupportedOperationException: JsonObject is thrown by BitbucketPullRequestActivityEnvelopeDeserializer when it fails to deserialize the pull request endpoint payload:

      https://developer.atlassian.com/bitbucket/api/2/reference/resource/repositories/%7Bworkspace%7D/%7Brepo_slug%7D/pullrequests/activity

      It parses the "pull_request" object and then attempts to find either one of the following json objects: "comment", "approval", or "update".

      If it fails to find either of these json objects then it throws the above exception.

      Replication steps

      • Create a Pull Request with an approver
      • Approver sets status to 'Changes Requested'
      • DVCS syncs Pull Request

      Expected Result

      DVCS ignores pull request activity type for `changes_requested`

      Actual result

      DVCS fails with pull request activity type for `changes_requested`

      Workaround

      None yet

      Suggested Fix

      Handle missing data correctly rather than throwing an exception.

      Also suggest we add more logging to diagnose the potential source of the issue as currently we can't tell what the contents of the payload from Bitbucket is.

       

      Attachments

        Activity

          People

            rarmstrong@atlassian.com Rory Armstrong (Inactive)
            rarmstrong@atlassian.com Rory Armstrong (Inactive)
            Votes:
            4 Vote for this issue
            Watchers:
            10 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: