It seems there is an issue with the variable renderer that causes it to attempt to render non-existant variables, such as $host in this case which was part of the commit title.
Steps to reproduce
Configure repo pull request notifications
Add button visible to everyone
Set the URL to https://x.x.x.y/git/notifyCommit?url=${PULL_REQUEST_FROM_SSH_CLONE_URL}
Method is post
Make a commit with a title that has a string prefixed with $ such as $host. Specifically found BNRSD-387 Fix circular reference logging on $host errors in RSD abstract client
2017-07-17 07:52:56,619 ERROR [http-nio-8080-exec-4] ahermosilla @1TE68TRx472x1160432x1 15brlxb 10.15.130.204,0:0:0:0:0:0:0:1 "POST /rest/prnfb-admin/1.0/settings/buttons/c0c2dc7d-bcaa-4f46-a488-c80f37c64f16/press/repository/308/pullrequest/233 HTTP/1.1" c.a.p.r.c.e.j.ThrowableExceptionMapper Uncaught exception thrown by REST service: Tried to replace \$\{PULL_REQUEST_TITLE\} with BNRSD-387 Fix circular reference logging on $host errors in RSD abstract client
java.lang.RuntimeException: Tried to replace \$\{PULL_REQUEST_TITLE\} with BNRSD-387 Fix circular reference logging on $host errors in RSD abstract client
at se.bjurr.prnfb.service.PrnfbRenderer.getRenderedStringResolved(PrnfbRenderer.java:96)
at se.bjurr.prnfb.service.PrnfbRenderer.renderVariable(PrnfbRenderer.java:150)
at se.bjurr.prnfb.service.PrnfbRenderer.render(PrnfbRenderer.java:117)
at se.bjurr.prnfb.listener.PrnfbPullRequestEventListener.notify(PrnfbPullRequestEventListener.java:242)
at se.bjurr.prnfb.service.ButtonsService.doHandlePressed(ButtonsService.java:108)
at se.bjurr.prnfb.service.ButtonsService.handlePressed(ButtonsService.java:160)
at se.bjurr.prnfb.presentation.ButtonServlet.press(ButtonServlet.java:172)
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.doFilter(StashAuthenticationFilter.java:88)
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.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)
... 237 frames trimmed
Caused by: java.lang.IllegalArgumentException: Illegal group reference
at java.util.regex.Matcher.appendReplacement(Matcher.java:857)
at java.util.regex.Matcher.replaceAll(Matcher.java:955)
at java.lang.String.replaceAll(String.java:2211)
at se.bjurr.prnfb.service.PrnfbRenderer.getRenderedStringResolved(PrnfbRenderer.java:94)
... 34 common frames omitted
It seems there is an issue with the variable renderer that causes it to attempt to render non-existant variables, such as
$host
in this case which was part of the commit title.Steps to reproduce
https://x.x.x.y/git/notifyCommit?url=${PULL_REQUEST_FROM_SSH_CLONE_URL}
$
such as$host
. Specifically foundBNRSD-387 Fix circular reference logging on $host errors in RSD abstract client
Pull Request Notifier 3.2
Atlassian Bitbucket v5.1.4