Uploaded image for project: 'Bitbucket Data Center'
  1. Bitbucket Data Center
  2. BSERV-11803

Creating a branch via REST with an incorrect body returns a 500 response code

    XMLWordPrintable

Details

    Description

      Steps to reproduce:

      • Try to create a branch via REST but don't put in the startPoint field of the body

       Expected behaviour:

      • Bitbucket returns a 400 with an appropriate error message

       Actual behaviour

      • Bitbucket returns a 500 with a "Something wen't wrong" error message.

      Workaround

      • Get the exception from the logs and see what went wrong

      Stack trace:

      2019-06-04 15:46:49,944 ERROR [http-nio-8080-exec-382] xxx.xxxxxx @1EEOS97x946x23379045x1 1lg0jtm xx.xx.xx.xx,127.0.0.1 "POST /rest/api/1.0/projects/<PROJECT_KEY>/repos/<repo-slug>/branches HTTP/1.0" c.a.s.i.r.e.DefaultUnhandledExceptionMapperHelper Unhandled exception while processing REST request: "POST /rest/api/1.0/projects/<PROJECT_KEY/repos/<repo_slug>/b
      ranches HTTP/1.0"
      java.lang.NullPointerException: startPoint
              at java.util.Objects.requireNonNull(Objects.java:228)
              at com.atlassian.bitbucket.util.BuilderSupport.requireNonBlank(BuilderSupport.java:86)
              at com.atlassian.bitbucket.util.BuilderSupport.checkNotBlank(BuilderSupport.java:73)
              at com.atlassian.bitbucket.repository.AbstractCreateRefRequest$AbstractBuilder.<init>(AbstractCreateRefRequest.java:71)
              at com.atlassian.bitbucket.repository.CreateBranchRequest$Builder.<init>(CreateBranchRequest.java:17)
              at com.atlassian.stash.internal.rest.repository.BranchResource.lambda$createBranch$0(BranchResource.java:74)
              at com.atlassian.stash.internal.rest.repository.BranchResource$$Lambda$2604/1211865235.apply(Unknown Source)
              at com.atlassian.stash.internal.rest.repository.AbstractRepositoryRefResource.process(AbstractRepositoryRefResource.java:25)
              at com.atlassian.stash.internal.rest.repository.BranchResource.createBranch(BranchResource.java:73)
              at com.atlassian.applinks.core.rest.context.ContextFilter.doFilter(ContextFilter.java:24)
              at com.atlassian.applinks.core.rest.context.ContextFilter.doFilter(ContextFilter.java:24)
              at com.atlassian.applinks.core.rest.context.ContextFilter.doFilter(ContextFilter.java:24)
              at com.atlassian.applinks.core.rest.context.ContextFilter.doFilter(ContextFilter.java:24)
              at com.atlassian.applinks.core.rest.context.ContextFilter.doFilter(ContextFilter.java:24)
              at com.atlassian.analytics.client.filter.UniversalAnalyticsFilter.doFilter(UniversalAnalyticsFilter.java:92)
              at com.atlassian.analytics.client.filter.AbstractHttpFilter.doFilter(AbstractHttpFilter.java:39)
              at com.atlassian.stash.internal.spring.lifecycle.LifecycleJohnsonServletFilterModuleContainerFilter.doFilter(LifecycleJohnsonServletFilterModuleContainerFilter.java:42)
              at com.atlassian.plugin.connect.plugin.auth.scope.ApiScopingFilter.doFilter(ApiScopingFilter.java:81)
              at com.atlassian.stash.internal.spring.lifecycle.LifecycleJohnsonServletFilterModuleContainerFilter.doFilter(LifecycleJohnsonServletFilterModuleContainerFilter.java:42)
              at com.atlassian.stash.internal.spring.security.StashAuthenticationFilter.onSuccess(StashAuthenticationFilter.java:219)
              at com.atlassian.stash.internal.spring.security.StashAuthenticationFilter.doFilter(StashAuthenticationFilter.java:100)
              at com.atlassian.stash.internal.web.auth.BeforeLoginPluginAuthenticationFilter.doInsideSpringSecurityChain(BeforeLoginPluginAuthenticationFilter.java:112)
              at com.atlassian.stash.internal.web.auth.BeforeLoginPluginAuthenticationFilter.doFilter(BeforeLoginPluginAuthenticationFilter.java:75)
              at com.atlassian.security.auth.trustedapps.filter.TrustedApplicationsFilter.doFilter(TrustedApplicationsFilter.java:94)
              at com.atlassian.oauth.serviceprovider.internal.servlet.OAuthFilter.doFilter(OAuthFilter.java:67)
              at com.atlassian.stash.internal.spring.lifecycle.LifecycleJohnsonServletFilterModuleContainerFilter.doFilter(LifecycleJohnsonServletFilterModuleContainerFilter.java:42)
              at com.atlassian.plugin.connect.plugin.auth.oauth2.DefaultSalAuthenticationFilter.doFilter(DefaultSalAuthenticationFilter.java:69)
              at com.atlassian.plugin.connect.plugin.auth.user.ThreeLeggedAuthFilter.doFilter(ThreeLeggedAuthFilter.java:109)
              at com.atlassian.jwt.internal.servlet.JwtAuthFilter.doFilter(JwtAuthFilter.java:32)
             at com.atlassian.analytics.client.filter.DefaultAnalyticsFilter.doFilter(DefaultAnalyticsFilter.java:38)
              at com.atlassian.analytics.client.filter.AbstractHttpFilter.doFilter(AbstractHttpFilter.java:39)
              at com.atlassian.stash.internal.spring.lifecycle.LifecycleJohnsonServletFilterModuleContainerFilter.doFilter(LifecycleJohnsonServletFilterModuleContainerFilter.java:42)
              at com.atlassian.stash.internal.web.auth.BeforeLoginPluginAuthenticationFilter.doBeforeBeforeLoginFilters(BeforeLoginPluginAuthenticationFilter.java:90)
              at com.atlassian.stash.internal.web.auth.BeforeLoginPluginAuthenticationFilter.doFilter(BeforeLoginPluginAuthenticationFilter.java:73)
              at com.atlassian.stash.internal.request.DefaultRequestManager.doAsRequest(DefaultRequestManager.java:89)
              at com.atlassian.stash.internal.hazelcast.ConfigurableWebFilter.doFilter(ConfigurableWebFilter.java:38)
              at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
              at java.lang.Thread.run(Thread.java:745)
              ... 239 frames trimmed 

      Attachments

        Issue Links

          Activity

            People

              khughes@atlassian.com Kristy
              khughes@atlassian.com Kristy
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: