Skip to content
This repository has been archived by the owner on Jun 9, 2021. It is now read-only.

Replacement failure can result in bad URLs #159

Closed
dcsobral opened this issue Nov 16, 2016 · 1 comment
Closed

Replacement failure can result in bad URLs #159

dcsobral opened this issue Nov 16, 2016 · 1 comment

Comments

@dcsobral
Copy link

I have setup my trigger with ${EVERYTHING_URL}, though that's really beside the point, and I've tried to trigger the build of a pull request whose author is no longer in our company. The PULL_REQUEST_AUTHOR_EMAIL parameter seems to be no longer available, and this is resulting in a bad URL when triggered, which, in turn, results in a 500 error when triggering, and the following exception on the log. Note that index 270 points to { in the original URL, but I've edited it to remove the token.

archPlayServiceImpl.java
2016-11-16 10:15:26,398 ERROR [http-nio-7990-exec-10] dsobral @GVZTWNx615x3128066x1 umdmco 209.212.63.130,127.0.0.1 "POST /rest/prnfb-admin/1.0/settings/buttons/b276f976-e9d0-4066-82a4-aa6efda864e8/press/repository/462/pullrequest/348 HTTP/1.0" se.bjurr.prnfb.service.PrnfbRenderer Error when resolving PULL_REQUEST_AUTHOR_EMAIL
java.lang.NullPointerException: null
2016-11-16 10:15:26,416 ERROR [http-nio-7990-exec-10] dsobral @GVZTWNx615x3128066x1 umdmco 209.212.63.130,127.0.0.1 "POST /rest/prnfb-admin/1.0/settings/buttons/b276f976-e9d0-4066-82a4-aa6efda864e8/press/repository/462/pullrequest/348 HTTP/1.0" c.a.p.r.c.e.j.ThrowableExceptionMapper Uncaught exception thrown by REST service: java.net.URISyntaxException: Illegal character in query at index 270: https://my.company.com/job/root_pipeline/buildWithParameters?token=XXXXX&BUTTON_TRIGGER_TITLE=Pipeline&INJECTION_URL_VALUE=&PULL_REQUEST_ACTION=BUTTON_TRIGGER&PULL_REQUEST_AUTHOR_DISPLAY_NAME=jcollins&PULL_REQUEST_AUTHOR_EMAIL=${PULL_REQUEST_AUTHOR_EMAIL}&PULL_REQUEST_AUTHOR_ID=77&PULL_REQUEST_AUTHOR_NAME=jcollins&PULL_REQUEST_AUTHOR_SLUG=jcollins&PULL_REQUEST_COMMENT_TEXT=&PULL_REQUEST_FROM_BRANCH=techdebt%2Feng-9909-add-cds-resolver-init-mode&PULL_REQUEST_FROM_HASH=fd378517c006350b397b5a028c3e2e42850d44cc&PULL_REQUEST_FROM_HTTP_CLONE_URL=https%3A%2F%2Fdsobral%40git.richrelevance.com%2Fscm%2F%7Ejcollins%2Fadv_merch.git&PULL_REQUEST_FROM_ID=refs%2Fheads%2Ftechdebt%2Feng-9909-add-cds-resolver-init-mode&PULL_REQUEST_FROM_REPO_ID=586&PULL_REQUEST_FROM_REPO_NAME=adv_merch&PULL_REQUEST_FROM_REPO_PROJECT_ID=64&PULL_REQUEST_FROM_REPO_PROJECT_KEY=%7EJCOLLINS&PULL_REQUEST_FROM_REPO_SLUG=adv_merch&PULL_REQUEST_FROM_SSH_CLONE_URL=ssh%3A%2F%2Fgit%40git.richrelevance.com%3A7999%2F%7Ejcollins%2Fadv_merch.git&PULL_REQUEST_ID=348&PULL_REQUEST_MERGE_COMMIT=&PULL_REQUEST_PARTICIPANTS_APPROVED_COUNT=0&PULL_REQUEST_REVIEWERS=Chirag+Arora%2CDaniel+Sobral%2CYug+Muppala&PULL_REQUEST_REVIEWERS_APPROVED_COUNT=2&PULL_REQUEST_REVIEWERS_ID=1303%2C39%2C78&PULL_REQUEST_REVIEWERS_SLUG=carora%2Cdsobral%2Cyug&PULL_REQUEST_STATE=OPEN&PULL_REQUEST_TITLE=ENG-9909%3A+add+cds+resolver+init+mode&PULL_REQUEST_TO_BRANCH=master&PULL_REQUEST_TO_HASH=a1ce654bc06866fe642a979c5e8c1733e986da70&PULL_REQUEST_TO_HTTP_CLONE_URL=https%3A%2F%2Fdsobral%40git.richrelevance.com%2Fscm%2Frr%2Fadv_merch.git&PULL_REQUEST_TO_ID=refs%2Fheads%2Fmaster&PULL_REQUEST_TO_REPO_ID=462&PULL_REQUEST_TO_REPO_NAME=adv_merch&PULL_REQUEST_TO_REPO_PROJECT_ID=21&PULL_REQUEST_TO_REPO_PROJECT_KEY=RR&PULL_REQUEST_TO_REPO_SLUG=adv_merch&PULL_REQUEST_TO_SSH_CLONE_URL=ssh%3A%2F%2Fgit%40git.richrelevance.com%3A7999%2Frr%2Fadv_merch.git&PULL_REQUEST_URL=https%3A%2F%2Fgit.richrelevance.com%2Fprojects%2FRR%2Frepos%2Fadv_merch%2Fpull-requests%2F348&PULL_REQUEST_USER_DISPLAY_NAME=Daniel+Sobral&PULL_REQUEST_USER_EMAIL_ADDRESS=dsobral%40richrelevance.com&PULL_REQUEST_USER_ID=39&PULL_REQUEST_USER_NAME=dsobral&PULL_REQUEST_USER_SLUG=dsobral&PULL_REQUEST_VERSION=22&cause=PR+Build+Button+Clicked
java.lang.RuntimeException: java.net.URISyntaxException: Illegal character in query at index 270: https://my.company.com/job/root_pipeline/buildWithParameters?token=XXXXX&BUTTON_TRIGGER_TITLE=Pipeline&INJECTION_URL_VALUE=&PULL_REQUEST_ACTION=BUTTON_TRIGGER&PULL_REQUEST_AUTHOR_DISPLAY_NAME=jcollins&PULL_REQUEST_AUTHOR_EMAIL=${PULL_REQUEST_AUTHOR_EMAIL}&PULL_REQUEST_AUTHOR_ID=77&PULL_REQUEST_AUTHOR_NAME=jcollins&PULL_REQUEST_AUTHOR_SLUG=jcollins&PULL_REQUEST_COMMENT_TEXT=&PULL_REQUEST_FROM_BRANCH=techdebt%2Feng-9909-add-cds-resolver-init-mode&PULL_REQUEST_FROM_HASH=fd378517c006350b397b5a028c3e2e42850d44cc&PULL_REQUEST_FROM_HTTP_CLONE_URL=https%3A%2F%2Fdsobral%40git.richrelevance.com%2Fscm%2F%7Ejcollins%2Fadv_merch.git&PULL_REQUEST_FROM_ID=refs%2Fheads%2Ftechdebt%2Feng-9909-add-cds-resolver-init-mode&PULL_REQUEST_FROM_REPO_ID=586&PULL_REQUEST_FROM_REPO_NAME=adv_merch&PULL_REQUEST_FROM_REPO_PROJECT_ID=64&PULL_REQUEST_FROM_REPO_PROJECT_KEY=%7EJCOLLINS&PULL_REQUEST_FROM_REPO_SLUG=adv_merch&PULL_REQUEST_FROM_SSH_CLONE_URL=ssh%3A%2F%2Fgit%40git.richrelevance.com%3A7999%2F%7Ejcollins%2Fadv_merch.git&PULL_REQUEST_ID=348&PULL_REQUEST_MERGE_COMMIT=&PULL_REQUEST_PARTICIPANTS_APPROVED_COUNT=0&PULL_REQUEST_REVIEWERS=Chirag+Arora%2CDaniel+Sobral%2CYug+Muppala&PULL_REQUEST_REVIEWERS_APPROVED_COUNT=2&PULL_REQUEST_REVIEWERS_ID=1303%2C39%2C78&PULL_REQUEST_REVIEWERS_SLUG=carora%2Cdsobral%2Cyug&PULL_REQUEST_STATE=OPEN&PULL_REQUEST_TITLE=ENG-9909%3A+add+cds+resolver+init+mode&PULL_REQUEST_TO_BRANCH=master&PULL_REQUEST_TO_HASH=a1ce654bc06866fe642a979c5e8c1733e986da70&PULL_REQUEST_TO_HTTP_CLONE_URL=https%3A%2F%2Fdsobral%40git.richrelevance.com%2Fscm%2Frr%2Fadv_merch.git&PULL_REQUEST_TO_ID=refs%2Fheads%2Fmaster&PULL_REQUEST_TO_REPO_ID=462&PULL_REQUEST_TO_REPO_NAME=adv_merch&PULL_REQUEST_TO_REPO_PROJECT_ID=21&PULL_REQUEST_TO_REPO_PROJECT_KEY=RR&PULL_REQUEST_TO_REPO_SLUG=adv_merch&PULL_REQUEST_TO_SSH_CLONE_URL=ssh%3A%2F%2Fgit%40git.richrelevance.com%3A7999%2Frr%2Fadv_merch.git&PULL_REQUEST_URL=https%3A%2F%2Fgit.richrelevance.com%2Fprojects%2FRR%2Frepos%2Fadv_merch%2Fpull-requests%2F348&PULL_REQUEST_USER_DISPLAY_NAME=Daniel+Sobral&PULL_REQUEST_USER_EMAIL_ADDRESS=dsobral%40richrelevance.com&PULL_REQUEST_USER_ID=39&PULL_REQUEST_USER_NAME=dsobral&PULL_REQUEST_USER_SLUG=dsobral&PULL_REQUEST_VERSION=22&cause=PR+Build+Button+Clicked
        at com.google.common.base.Throwables.propagate(Throwables.java:160) ~[guava-18.0.jar:na]
        at se.bjurr.prnfb.http.UrlInvoker.configureUrl(UrlInvoker.java:264) ~[plugin.1713595038025063254.pull-request-notifier-for-bitbucket-2.37_1471493348000.jar:na]
        at se.bjurr.prnfb.http.UrlInvoker.invoke(UrlInvoker.java:156) ~[plugin.1713595038025063254.pull-request-notifier-for-bitbucket-2.37_1471493348000.jar:na]
        at se.bjurr.prnfb.listener.PrnfbPullRequestEventListener$2.invoke(PrnfbPullRequestEventListener.java:227) ~[plugin.1713595038025063254.pull-request-notifier-for-bitbucket-2.37_1471493348000.jar:na]
        at se.bjurr.prnfb.listener.PrnfbPullRequestEventListener.notify(PrnfbPullRequestEventListener.java:160) ~[plugin.1713595038025063254.pull-request-notifier-for-bitbucket-2.37_1471493348000.jar:na]
        at se.bjurr.prnfb.service.ButtonsService.doHandlePressed(ButtonsService.java:117) ~[plugin.1713595038025063254.pull-request-notifier-for-bitbucket-2.37_1471493348000.jar:na]
        at se.bjurr.prnfb.service.ButtonsService.handlePressed(ButtonsService.java:62) ~[plugin.1713595038025063254.pull-request-notifier-for-bitbucket-2.37_1471493348000.jar:na]
        at se.bjurr.prnfb.presentation.ButtonServlet.press(ButtonServlet.java:158) ~[plugin.1713595038025063254.pull-request-notifier-for-bitbucket-2.37_1471493348000.jar:na]
        at com.atlassian.applinks.core.rest.context.ContextFilter.doFilter(ContextFilter.java:24) [applinks-plugin-5.2.2_1476279238000.jar:na]
        at com.atlassian.applinks.core.rest.context.ContextFilter.doFilter(ContextFilter.java:24) [applinks-plugin-5.2.2_1476279238000.jar:na]
        at com.atlassian.applinks.core.rest.context.ContextFilter.doFilter(ContextFilter.java:24) [applinks-plugin-5.2.2_1476279238000.jar:na]
        at com.atlassian.applinks.core.rest.context.ContextFilter.doFilter(ContextFilter.java:24) [applinks-plugin-5.2.2_1476279238000.jar:na]
        at com.atlassian.analytics.client.filter.UniversalAnalyticsFilter.doFilter(UniversalAnalyticsFilter.java:92) [analytics-client-5.2.9_1476279238000.jar:na]
        at com.atlassian.analytics.client.filter.AbstractHttpFilter.doFilter(AbstractHttpFilter.java:39) [analytics-client-5.2.9_1476279238000.jar:na]
        at com.atlassian.plugin.connect.plugin.auth.scope.ApiScopingFilter.doFilter(ApiScopingFilter.java:81) [atlassian-connect-plugin-1.1.86-bitbucket-04.jar:na]
        at com.atlassian.stash.internal.spring.security.StashAuthenticationFilter.doFilter(StashAuthenticationFilter.java:88) [classes/:na]
        at com.atlassian.stash.internal.web.auth.BeforeLoginPluginAuthenticationFilter.doInsideSpringSecurityChain(BeforeLoginPluginAuthenticationFilter.java:109) [classes/:na]
        at com.atlassian.stash.internal.web.auth.BeforeLoginPluginAuthenticationFilter.doFilter(BeforeLoginPluginAuthenticationFilter.java:75) [classes/:na]
        at com.atlassian.security.auth.trustedapps.filter.TrustedApplicationsFilter.doFilter(TrustedApplicationsFilter.java:94) [atlassian-trusted-apps-core-4.2.0.jar:na]
        at com.atlassian.oauth.serviceprovider.internal.servlet.OAuthFilter.doFilter(OAuthFilter.java:67) [atlassian-oauth-service-provider-plugin-2.0.3_1476279238000.jar:na]
        at com.atlassian.core.filters.ServletContextThreadLocalFilter.doFilter(ServletContextThreadLocalFilter.java:21) [atlassian-core-4.6.19.jar:na]
        at com.atlassian.core.filters.AbstractHttpFilter.doFilter(AbstractHttpFilter.java:31) [atlassian-core-4.6.19.jar:na]
        at com.atlassian.plugin.connect.plugin.auth.user.ThreeLeggedAuthFilter.doFilter(ThreeLeggedAuthFilter.java:109) [atlassian-connect-plugin-1.1.86-bitbucket-04.jar:na]
        at com.atlassian.jwt.internal.servlet.JwtAuthFilter.doFilter(JwtAuthFilter.java:32) [jwt-plugin-1.5.11-0002_1476279238000.jar:na]
        at com.atlassian.analytics.client.filter.DefaultAnalyticsFilter.doFilter(DefaultAnalyticsFilter.java:38) [analytics-client-5.2.9_1476279238000.jar:na]
        at com.atlassian.analytics.client.filter.AbstractHttpFilter.doFilter(AbstractHttpFilter.java:39) [analytics-client-5.2.9_1476279238000.jar:na]
        at com.atlassian.stash.internal.web.auth.BeforeLoginPluginAuthenticationFilter.doBeforeBeforeLoginFilters(BeforeLoginPluginAuthenticationFilter.java:87) [classes/:na]
        at com.atlassian.stash.internal.web.auth.BeforeLoginPluginAuthenticationFilter.doFilter(BeforeLoginPluginAuthenticationFilter.java:73) [classes/:na]
        at com.atlassian.stash.internal.request.DefaultRequestManager.doAsRequest(DefaultRequestManager.java:86) [bitbucket-service-impl-4.10.1.jar:na]
        at com.atlassian.stash.internal.hazelcast.ConfigurableWebFilter.doFilter(ConfigurableWebFilter.java:38) [classes/:na]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_45]
        at java.lang.Thread.run(Thread.java:745) [na:1.8.0_45]
        ... 233 frames trimmed
Caused by: java.net.URISyntaxException: Illegal character in query at index 270: https://my.company.com/job/root_pipeline/buildWithParameters?token=XXXXX&BUTTON_TRIGGER_TITLE=Pipeline&INJECTION_URL_VALUE=&PULL_REQUEST_ACTION=BUTTON_TRIGGER&PULL_REQUEST_AUTHOR_DISPLAY_NAME=jcollins&PULL_REQUEST_AUTHOR_EMAIL=${PULL_REQUEST_AUTHOR_EMAIL}&PULL_REQUEST_AUTHOR_ID=77&PULL_REQUEST_AUTHOR_NAME=jcollins&PULL_REQUEST_AUTHOR_SLUG=jcollins&PULL_REQUEST_COMMENT_TEXT=&PULL_REQUEST_FROM_BRANCH=techdebt%2Feng-9909-add-cds-resolver-init-mode&PULL_REQUEST_FROM_HASH=fd378517c006350b397b5a028c3e2e42850d44cc&PULL_REQUEST_FROM_HTTP_CLONE_URL=https%3A%2F%2Fdsobral%40git.richrelevance.com%2Fscm%2F%7Ejcollins%2Fadv_merch.git&PULL_REQUEST_FROM_ID=refs%2Fheads%2Ftechdebt%2Feng-9909-add-cds-resolver-init-mode&PULL_REQUEST_FROM_REPO_ID=586&PULL_REQUEST_FROM_REPO_NAME=adv_merch&PULL_REQUEST_FROM_REPO_PROJECT_ID=64&PULL_REQUEST_FROM_REPO_PROJECT_KEY=%7EJCOLLINS&PULL_REQUEST_FROM_REPO_SLUG=adv_merch&PULL_REQUEST_FROM_SSH_CLONE_URL=ssh%3A%2F%2Fgit%40git.richrelevance.com%3A7999%2F%7Ejcollins%2Fadv_merch.git&PULL_REQUEST_ID=348&PULL_REQUEST_MERGE_COMMIT=&PULL_REQUEST_PARTICIPANTS_APPROVED_COUNT=0&PULL_REQUEST_REVIEWERS=Chirag+Arora%2CDaniel+Sobral%2CYug+Muppala&PULL_REQUEST_REVIEWERS_APPROVED_COUNT=2&PULL_REQUEST_REVIEWERS_ID=1303%2C39%2C78&PULL_REQUEST_REVIEWERS_SLUG=carora%2Cdsobral%2Cyug&PULL_REQUEST_STATE=OPEN&PULL_REQUEST_TITLE=ENG-9909%3A+add+cds+resolver+init+mode&PULL_REQUEST_TO_BRANCH=master&PULL_REQUEST_TO_HASH=a1ce654bc06866fe642a979c5e8c1733e986da70&PULL_REQUEST_TO_HTTP_CLONE_URL=https%3A%2F%2Fdsobral%40git.richrelevance.com%2Fscm%2Frr%2Fadv_merch.git&PULL_REQUEST_TO_ID=refs%2Fheads%2Fmaster&PULL_REQUEST_TO_REPO_ID=462&PULL_REQUEST_TO_REPO_NAME=adv_merch&PULL_REQUEST_TO_REPO_PROJECT_ID=21&PULL_REQUEST_TO_REPO_PROJECT_KEY=RR&PULL_REQUEST_TO_REPO_SLUG=adv_merch&PULL_REQUEST_TO_SSH_CLONE_URL=ssh%3A%2F%2Fgit%40git.richrelevance.com%3A7999%2Frr%2Fadv_merch.git&PULL_REQUEST_URL=https%3A%2F%2Fgit.richrelevance.com%2Fprojects%2FRR%2Frepos%2Fadv_merch%2Fpull-requests%2F348&PULL_REQUEST_USER_DISPLAY_NAME=Daniel+Sobral&PULL_REQUEST_USER_EMAIL_ADDRESS=dsobral%40richrelevance.com&PULL_REQUEST_USER_ID=39&PULL_REQUEST_USER_NAME=dsobral&PULL_REQUEST_USER_SLUG=dsobral&PULL_REQUEST_VERSION=22&cause=PR+Build+Button+Clicked
        at java.net.URI$Parser.fail(URI.java:2848) ~[na:1.8.0_45]
        at java.net.URI$Parser.checkChars(URI.java:3021) ~[na:1.8.0_45]
        at java.net.URI$Parser.parseHierarchical(URI.java:3111) ~[na:1.8.0_45]
        at java.net.URI$Parser.parse(URI.java:3053) ~[na:1.8.0_45]
        at java.net.URI.<init>(URI.java:588) ~[na:1.8.0_45]
        at se.bjurr.prnfb.http.UrlInvoker.configureUrl(UrlInvoker.java:262) ~[plugin.1713595038025063254.pull-request-notifier-for-bitbucket-2.37_1471493348000.jar:na]
        ... 32 common frames omitted
tomasbjerre added a commit that referenced this issue Nov 16, 2016
 * If a crash happens, like NPE, when a variable was resolved. Then that variable would be kept unchanged. Resulting in illegal chars in URL.
@tomasbjerre
Copy link
Owner

Should be fixed in 2.39. Open issue again if any problems!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants