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

Auto merge fails with runtime exception when release branches don't have a number in the name

    XMLWordPrintable

Details

    Description

      The offending code is in BranchVersion.compareTo. We should probably just throw a more meaningful exception, as without numeric components trying to compare the branches is not a great idea.

      c.a.s.i.e.AsyncBatchingInvokersTransformer There was an exception thrown trying to dispatch event 'com.atlassian.stash.event.pull.PullRequestMergedEvent[source=com.atlassian.stash.internal.pull.PullRequestServiceImpl@2bfc34d3]' for the invoker 'SingleParameterMethodListenerInvoker{method=public void com.atlassian.stash.internal.branch.automerge.AutoMergePullRequestProcessor.onPullRequestMerged(com.atlassian.stash.event.pull.PullRequestMergedEvent), listener=com.atlassian.stash.internal.branch.automerge.AutoMergePullRequestProcessor@3d1fc30e}'.
      java.lang.RuntimeException: index (-1) must not be negative
      at com.atlassian.event.internal.SingleParameterMethodListenerInvoker.invoke(SingleParameterMethodListenerInvoker.java:54) ~[atlassian-event-2.3.5.jar:na]
      at com.atlassian.stash.internal.event.AsyncBatchingInvokersTransformer$AsyncInvokerBatch.invoke(AsyncBatchingInvokersTransformer.java:100) ~[stash-platform-3.2.0.jar:na]
      at com.atlassian.event.internal.AsynchronousAbleEventDispatcher$1$1.run(AsynchronousAbleEventDispatcher.java:48) [atlassian-event-2.3.5.jar:na]
      at com.atlassian.sal.core.executor.ThreadLocalDelegateRunnable.run(ThreadLocalDelegateRunnable.java:38) [sal-core-2.12.1.jar:na]
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [na:1.7.0_60]
      at java.lang.Thread.run(Thread.java:745) [na:1.7.0_60]
      ... 1 frame trimmed
      Caused by: java.lang.IndexOutOfBoundsException: index (-1) must not be negative
      at com.google.common.base.Preconditions.checkElementIndex(Preconditions.java:301) ~[guava-11.0.2-atlassian-01.jar:na]
      at com.google.common.base.Preconditions.checkElementIndex(Preconditions.java:280) ~[guava-11.0.2-atlassian-01.jar:na]
      at com.google.common.collect.SingletonImmutableList.get(SingletonImmutableList.java:46) ~[guava-11.0.2-atlassian-01.jar:na]
      at com.atlassian.stash.internal.branch.model.version.BranchVersion.componentAt(BranchVersion.java:155) ~[na:na]
      at com.atlassian.stash.internal.branch.model.version.BranchVersion.compareTo(BranchVersion.java:67) ~[na:na]
      at com.atlassian.stash.internal.branch.model.version.VersionedBranch.compareTo(VersionedBranch.java:84) ~[na:na]
      at com.atlassian.stash.internal.branch.model.version.VersionedBranch$4.apply(VersionedBranch.java:77) ~[na:na]
      at com.atlassian.stash.internal.branch.model.version.VersionedBranch$4.apply(VersionedBranch.java:74) ~[na:na]
      at com.google.common.base.Predicates$AndPredicate.apply(Predicates.java:338) ~[guava-11.0.2-atlassian-01.jar:na]
      at com.google.common.collect.Iterators$7.computeNext(Iterators.java:649) ~[guava-11.0.2-atlassian-01.jar:na]
      at com.google.common.collect.AbstractIterator.tryToComputeNext(AbstractIterator.java:143) ~[guava-11.0.2-atlassian-01.jar:na]
      at com.google.common.collect.AbstractIterator.hasNext(AbstractIterator.java:138) ~[guava-11.0.2-atlassian-01.jar:na]
      at com.google.common.collect.Lists.newArrayList(Lists.java:138) ~[guava-11.0.2-atlassian-01.jar:na]
      at com.google.common.collect.Lists.newArrayList(Lists.java:119) ~[guava-11.0.2-atlassian-01.jar:na]
      at com.google.common.collect.NaturalOrdering.sortedCopy(NaturalOrdering.java:57) ~[guava-11.0.2-atlassian-01.jar:na]
      at com.google.common.collect.Ordering.immutableSortedCopy(Ordering.java:534) ~[guava-11.0.2-atlassian-01.jar:na]
      at com.atlassian.stash.util.Chainable.sort(Chainable.java:102) ~[stash-util-3.2.0.jar:na]
      at com.atlassian.stash.internal.branch.model.SimpleBranchModel.getMergePath(SimpleBranchModel.java:72) ~[na:na]
      at com.atlassian.stash.internal.branch.automerge.DefaultAutoMergeService$$anonfun$getDownstreamBranches$2.apply(DefaultAutoMergeService.scala:44) ~[na:na]
      at
      

      Attachments

        Issue Links

          Activity

            People

              mheemskerk Michael Heemskerk (Inactive)
              dkordonski Dariusz Kordonski (Inactive)
              Votes:
              1 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: