Nullpointer exception hook

Issue #37 resolved
Former user created an issue

Hi,

We installed the new Bitbucket version (5.1.0) and the latest HTTP-Request Hook plugin (4.3.0) but unfortunately with some hooks failed because of nullpointers. Could you examine this problem?

2017-06-20 11:30:19,305 DEBUG [AtlassianEvent::thread-6] buildserver @1Y58UGEx690x957x0 7u77o9 10.195.135.40 SSH - git-receive-pack '/fc/fc-key-value.git' d.a.s.p.hook.HttpGetPostReceiveHook Http Get Post Receive Hook started. 2017-06-20 11:30:19,305 DEBUG [AtlassianEvent::thread-6] buildserver @1Y58UGEx690x957x0 7u77o9 10.195.135.40 SSH - git-receive-pack '/fc/fc-key-value.git' d.a.s.p.hook.HttpGetPostReceiveHook User: buildserver 2017-06-20 11:30:19,305 DEBUG [AtlassianEvent::thread-6] buildserver @1Y58UGEx690x957x0 7u77o9 10.195.135.40 SSH - git-receive-pack '/fc/fc-key-value.git' d.a.s.p.hook.HttpGetPostReceiveHook Number of HttpLocations: 1 2017-06-20 11:30:19,305 DEBUG [AtlassianEvent::thread-6] buildserver @1Y58UGEx690x957x0 7u77o9 10.195.135.40 SSH - git-receive-pack '/fc/fc-key-value.git' d.a.s.p.hook.HttpGetPostReceiveHook Number of HttpLocations: 1 2017-06-20 11:30:19,305 DEBUG [AtlassianEvent::thread-6] buildserver @1Y58UGEx690x957x0 7u77o9 10.195.135.40 SSH - git-receive-pack '/fc/fc-key-value.git' d.a.s.p.hook.HttpGetPostReceiveHook RefChange: refs/tags/LATEST_DEVELOP 2017-06-20 11:30:19,313 DEBUG [AtlassianEvent::thread-6] buildserver @1Y58UGEx690x957x0 7u77o9 10.195.135.40 SSH - git-receive-pack '/fc/fc-key-value.git' d.a.s.p.hook.HttpGetPostReceiveHook HttpLocation: null 2017-06-20 11:30:19,313 DEBUG [AtlassianEvent::thread-6] buildserver @1Y58UGEx690x957x0 7u77o9 10.195.135.40 SSH - git-receive-pack '/fc/fc-key-value.git' d.a.s.p.hook.HttpGetPostReceiveHook HttpLocationTranslated: http://cdrelease-acc.verz-ota.local/online/rest/hook/service/hook/updateBranches/FC/fc-key-value/?changeType=UPDATE&changeBranch=LATEST_DEVELOP&userId=buildserver 2017-06-20 11:30:19,317 ERROR [AtlassianEvent::thread-6] buildserver @1Y58UGEx690x957x0 7u77o9 10.195.135.40 SSH - git-receive-pack '/fc/fc-key-value.git' d.a.s.p.hook.HttpGetPostReceiveHook Problem calling http://cdrelease-acc.verz-ota.local/online/rest/hook/service/hook/updateBranches/FC/fc-key-value/?changeType=UPDATE&changeBranch=LATEST_DEVELOP&userId=buildserver java.lang.NullPointerException: null at de.aeffle.stash.plugin.hook.http.agent.HttpAgent.doRequest(HttpAgent.java:113) at de.aeffle.stash.plugin.hook.HttpGetPostReceiveHook.postReceive(HttpGetPostReceiveHook.java:127) at com.atlassian.stash.internal.plugin.legacy.AsyncPostReceiveRepositoryHookAdapter.postUpdate(AsyncPostReceiveRepositoryHookAdapter.java:22) at com.atlassian.stash.internal.plugin.legacy.CompositeRepositoryHook.lambda$postUpdate$1(CompositeRepositoryHook.java:58) at com.atlassian.stash.internal.plugin.legacy.CompositeRepositoryHook.handlingExceptions(CompositeRepositoryHook.java:86) at com.atlassian.stash.internal.plugin.legacy.CompositeRepositoryHook.postUpdate(CompositeRepositoryHook.java:57) at com.atlassian.stash.internal.hook.repository.DefaultRepositoryHookService.postUpdate(DefaultRepositoryHookService.java:573) at com.atlassian.stash.internal.hook.repository.DefaultRepositoryHookService.doPostUpdate(DefaultRepositoryHookService.java:417) at com.atlassian.stash.internal.hook.repository.DefaultRepositoryHookService.postUpdate(DefaultRepositoryHookService.java:235) at com.atlassian.stash.internal.hook.repository.CoreRefChangeEventToRepositoryHookAdapter.onRefsChanged(CoreRefChangeEventToRepositoryHookAdapter.java:49) at com.atlassian.event.internal.SingleParameterMethodListenerInvoker.invoke(SingleParameterMethodListenerInvoker.java:40) at com.atlassian.stash.internal.event.AsyncBatchingInvokersTransformer$AsyncInvokerBatch.invoke(AsyncBatchingInvokersTransformer.java:109) at com.atlassian.event.internal.AsynchronousAbleEventDispatcher$1$1.run(AsynchronousAbleEventDispatcher.java:38) at com.atlassian.sal.core.executor.ThreadLocalDelegateRunnable.run(ThreadLocalDelegateRunnable.java:34) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.lang.Thread.run(Thread.java:748) ... 29 frames trimmed

Comments (7)

  1. Alexander Renteln

    Hi,

    I just had a look into your problem. I think it has to do with the fact that the HTTP response does not contain any content (empty body).

    Can you check the following:

    1. The http request should be done - so the webserver should have received a call. Is this correct?

    2. Does the body of the requested page contain anything?

    Best, Alex

  2. Rob Bankers Account Deactivated

    Hi,

    That is true the HTTP POST has no body and the HTTP request is recieved on the other side. But I don`t expect a nullpointer on that matter.

    Besides this nullpointer exception we got another error:

    2017-06-21 15:43:12,616 DEBUG [AtlassianEvent::thread-1] fp-release @1PU4J19x943x3034x0 10.195.135.123 "DELETE /rest/branch-utils/1.0/projects/VIADGS/repos/via-dgs-core/branches HTTP/1.1" d.a.s.p.hook.HttpGetPostReceiveHook Http Get Post Receive Hook started. 2017-06-21 15:43:12,616 DEBUG [AtlassianEvent::thread-1] fp-release @1PU4J19x943x3034x0 10.195.135.123 "DELETE /rest/branch-utils/1.0/projects/VIADGS/repos/via-dgs-core/branches HTTP/1.1" d.a.s.p.hook.HttpGetPostReceiveHook User: fp-release 2017-06-21 15:43:12,616 DEBUG [AtlassianEvent::thread-1] fp-release @1PU4J19x943x3034x0 10.195.135.123 "DELETE /rest/branch-utils/1.0/projects/VIADGS/repos/via-dgs-core/branches HTTP/1.1" d.a.s.p.hook.HttpGetPostReceiveHook Number of HttpLocations: 1 2017-06-21 15:43:12,616 DEBUG [AtlassianEvent::thread-1] fp-release @1PU4J19x943x3034x0 10.195.135.123 "DELETE /rest/branch-utils/1.0/projects/VIADGS/repos/via-dgs-core/branches HTTP/1.1" d.a.s.p.hook.HttpGetPostReceiveHook RefChange: refs/heads/feature/CD_RELEASE_FIXES 2017-06-21 15:43:12,616 DEBUG [AtlassianEvent::thread-1] fp-release @1PU4J19x943x3034x0 10.195.135.123 "DELETE /rest/branch-utils/1.0/projects/VIADGS/repos/via-dgs-core/branches HTTP/1.1" d.a.s.p.hook.HttpGetPostReceiveHook Number of HttpLocations: 1 2017-06-21 15:43:12,616 DEBUG [AtlassianEvent::thread-1] fp-release @1PU4J19x943x3034x0 10.195.135.123 "DELETE /rest/branch-utils/1.0/projects/VIADGS/repos/via-dgs-core/branches HTTP/1.1" d.a.s.p.hook.HttpGetPostReceiveHook RefChange: refs/heads/feature/CD_RELEASE_FIXES 2017-06-21 15:43:12,620 WARN [AtlassianEvent::thread-1] fp-release @1PU4J19x943x3034x0 10.195.135.123 "DELETE /rest/branch-utils/1.0/projects/VIADGS/repos/via-dgs-core/branches HTTP/1.1" c.a.s.i.h.r.DefaultRepositoryHookService [VIADGS/via-dgs-core[2717]] Error calling CompositeRepositoryHook.postUpdate com.atlassian.bitbucket.commit.NoSuchCommitException: Commit '0000000000000000000000000000000000000000' does not exist in repository 'VIA DGS Core'. at com.atlassian.bitbucket.scm.git.command.GitCommandExitHandler.newNoSuchCommitException(GitCommandExitHandler.java:167) at com.atlassian.bitbucket.scm.git.command.GitCommandExitHandler.evaluateStdErr(GitCommandExitHandler.java:70) at com.atlassian.bitbucket.scm.git.command.GitCommandExitHandler.onError(GitCommandExitHandler.java:197) at com.atlassian.bitbucket.scm.DefaultCommandExitHandler.onExit(DefaultCommandExitHandler.java:31) at com.atlassian.bitbucket.scm.BaseCommand.callExitHandler(BaseCommand.java:146) at com.atlassian.bitbucket.scm.BaseCommand$CommandFuture.internalGet(BaseCommand.java:280) at com.atlassian.bitbucket.scm.BaseCommand$CommandFuture.get(BaseCommand.java:244) at com.atlassian.bitbucket.scm.BaseCommand.call(BaseCommand.java:83) at com.atlassian.stash.internal.commit.DefaultCommitService.getCommit(DefaultCommitService.java:159) at com.atlassian.plugin.util.ContextClassLoaderSettingInvocationHandler.invoke(ContextClassLoaderSettingInvocationHandler.java:26) at de.aeffle.stash.plugin.hook.http.location.UrlTemplateTranslator.addCommitMessage(UrlTemplateTranslator.java:115) at de.aeffle.stash.plugin.hook.http.location.UrlTemplateTranslator.<init>(UrlTemplateTranslator.java:67) at de.aeffle.stash.plugin.hook.HttpGetPostReceiveHook.postReceive(HttpGetPostReceiveHook.java:111) at com.atlassian.stash.internal.plugin.legacy.AsyncPostReceiveRepositoryHookAdapter.postUpdate(AsyncPostReceiveRepositoryHookAdapter.java:22) at com.atlassian.stash.internal.plugin.legacy.CompositeRepositoryHook.lambda$postUpdate$1(CompositeRepositoryHook.java:58) at com.atlassian.stash.internal.plugin.legacy.CompositeRepositoryHook.handlingExceptions(CompositeRepositoryHook.java:86) at com.atlassian.stash.internal.plugin.legacy.CompositeRepositoryHook.postUpdate(CompositeRepositoryHook.java:57) at com.atlassian.stash.internal.hook.repository.DefaultRepositoryHookService.postUpdate(DefaultRepositoryHookService.java:573) at com.atlassian.stash.internal.hook.repository.DefaultRepositoryHookService.doPostUpdate(DefaultRepositoryHookService.java:417) at com.atlassian.stash.internal.hook.repository.DefaultRepositoryHookService.postUpdate(DefaultRepositoryHookService.java:235) at com.atlassian.stash.internal.hook.repository.CoreRefChangeEventToRepositoryHookAdapter.onRefsChanged(CoreRefChangeEventToRepositoryHookAdapter.java:49) at com.atlassian.event.internal.SingleParameterMethodListenerInvoker.invoke(SingleParameterMethodListenerInvoker.java:40) at com.atlassian.stash.internal.event.AsyncBatchingInvokersTransformer$AsyncInvokerBatch.invoke(AsyncBatchingInvokersTransformer.java:109) at com.atlassian.event.internal.AsynchronousAbleEventDispatcher$1$1.run(AsynchronousAbleEventDispatcher.java:38) at com.atlassian.sal.core.executor.ThreadLocalDelegateRunnable.run(ThreadLocalDelegateRunnable.java:34) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.lang.Thread.run(Thread.java:748) ... 74 frames trimmed

    Any thoughts about this exception?

    Thxs

  3. Rob Bankers Account Deactivated

    More information when the NoSuchCommitException occurs there is no HTTP hook for this delete action.

  4. Alexander Renteln

    Hi Rob, sorry for not replying earlier. Let me fix it for you.. I'll do a release this evening...

    It's currently open-source. I moved it to another location and forgot to make it public again. I didn't bother since nobody did any PRs and only created issues... But if you want to see some code, no worries. I'll fix it :-)

    Cheers, Alex

  5. Alexander Renteln

    So, I fixed your first problem. The second one is also easy... damn it - I'm kind of embarrassed that I only thought of the happy path. This happens when you delete a branch via a push (push nothing to a branch - like this: git push origin :branch_name). And I introduced the commit message of the from and to refs... and I only check if the whole refChange is not null... ignoring that the toRef could still be null.... You'll get the fix in a second release, tonight...

  6. Log in to comment