Issue Summary
Running Bitbucket DC 8.8 and Java 17, when a RefsSynchronizedEvent is triggered the ApplicationWebhookEventDispatcher causes the following error whilst attempting to publish the said event:
2023-02-12 23:18:41,205 ERROR [AtlassianEvent::thread-25] c.a.s.i.e.AsyncBatchingInvokersTransformer There was an exception thrown trying to dispatch event 'com.atlassian.bitbucket.repository.sync.RefsSynchronizedEvent[source=com.atlassian.stash.internal.repository.sync.DefaultRefSyncService@494616d2]' for the invoker 'com.atlassian.event.internal.ComparableListenerInvoker@5ff46cbf' java.lang.RuntimeException: Could not access 'user' from 'com.atlassian.bitbucket.internal.webhook.event.InternalRepositoryWebhookRefsChangedEvent[source=com.atlassian.bitbucket.internal.webhook.ApplicationWebhookEventDispatcher@4a9d9bab]'. Listener: com.atlassian.bitbucket.internal.webhook.ApplicationWebhookEventDispatcher event: com.atlassian.bitbucket.repository.sync.RefsSynchronizedEvent at com.atlassian.event.internal.SingleParameterMethodListenerInvoker.invoke(SingleParameterMethodListenerInvoker.java:53) at com.atlassian.diagnostics.internal.platform.monitor.event.EventSystemMonitor.invokeMonitored(EventSystemMonitor.java:105) at com.atlassian.diagnostics.internal.platform.monitor.event.MonitoredListenerInvoker.invoke(MonitoredListenerInvoker.java:38) at com.atlassian.event.internal.ComparableListenerInvoker.invoke(ComparableListenerInvoker.java:48) at com.atlassian.stash.internal.event.AsyncBatchingInvokersTransformer$AsyncInvokerBatch.invoke(AsyncBatchingInvokersTransformer.java:111) at com.atlassian.event.internal.AsynchronousAbleEventDispatcher.lambda$null$0(AsynchronousAbleEventDispatcher.java:37) at com.atlassian.sal.core.executor.ThreadLocalDelegateRunnable.run(ThreadLocalDelegateRunnable.java:34) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) at com.atlassian.stash.internal.event.EventThreadFactory.lambda$createThread$0(EventThreadFactory.java:35) at java.base/java.lang.Thread.run(Thread.java:833) ... 1 frame trimmed Caused by: com.atlassian.plugins.rest.common.util.FieldAccessibilityException: Could not access 'user' from 'com.atlassian.bitbucket.internal.webhook.event.InternalRepositoryWebhookRefsChangedEvent[source=com.atlassian.bitbucket.internal.webhook.ApplicationWebhookEventDispatcher@4a9d9bab]' at com.atlassian.plugins.rest.common.util.ReflectionUtils.setFieldValue(ReflectionUtils.java:67) at com.atlassian.bitbucket.internal.webhook.ApplicationWebhookEventDispatcher.setUser(ApplicationWebhookEventDispatcher.java:456) at com.atlassian.bitbucket.internal.webhook.ApplicationWebhookEventDispatcher.onRepositoryRefsChanged(ApplicationWebhookEventDispatcher.java:208) at jdk.internal.reflect.GeneratedMethodAccessor1658.invoke(Unknown Source) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at com.atlassian.event.internal.SingleParameterMethodListenerInvoker.invoke(SingleParameterMethodListenerInvoker.java:42) ... 10 common frames omitted Caused by: java.lang.IllegalAccessException: class com.atlassian.plugins.rest.common.util.ReflectionUtils cannot access a member of class com.atlassian.bitbucket.event.ApplicationEvent with modifiers "private final" at java.base/jdk.internal.reflect.Reflection.newIllegalAccessException(Reflection.java:392) ... 15 common frames omitted
Steps to Reproduce
TBD. Unsuccessful in reproducing. Attempt based on codepath in error:
- Create a forked repository.
- Create a webhook for a push event within the forked repository.
- Ensure fork synchronization is enabled.
- Push a commit to the origin to trigger the webhook.
- Observe the logs and webhook request.
Expected Results
The webhook request should be sent.
Actual Results
The above error is thrown.