The reindex functions take a context which is created by Context.Builder() progress functions which have confusing API's

I am attempting to use Context.Builder() in combination with the IssueIndexingService.reIndexAll(), but cannot make sense of the arguments to the progress* methods. My current attempt is:

    @Autowired
    private IssueIndexingService issueIndexingService;

    @Autowired
    private I18nHelper i18nHelper;

...

    @Override
    public void reindex() throws IndexException {
        issueIndexingService.reIndexAll(
                new Context.Builder()
                        .progress(
                                ( taskProgress, currentSubTask, message ) -> {
                                    log.info(
                                            "reindex progress={} current={}",
                                            taskProgress,
                                            currentSubTask );
                                },
                                i18nHelper,
                                null,
                                null )
                        .build(),
                true,
                IssueIndexingParams.INDEX_ISSUE_ONLY,
                false );
    }

But this results in a NullPointerException (on the only line inside the reindex method):

java.lang.NullPointerException
        at com.atlassian.jira.issue.index.DefaultIndexManager.doBackgroundReindex(DefaultIndexManager.java:1084) [classes/:?]
        at com.atlassian.jira.issue.index.DefaultIndexManager.reIndexAll(DefaultIndexManager.java:354) [classes/:?]
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [?:?]
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) [?:?]
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [?:?]
        at java.base/java.lang.reflect.Method.invoke(Method.java:566) [?:?]
        at com.atlassian.jira.config.component.SwitchingInvocationHandler.invoke(SwitchingInvocationHandler.java:38) [classes/:?]
        at com.sun.proxy.$Proxy45.reIndexAll(Unknown Source) [?:?]
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [?:?]
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) [?:?]
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [?:?]
        at java.base/java.lang.reflect.Method.invoke(Method.java:566) [?:?]
        at com.atlassian.plugin.util.ContextClassLoaderSettingInvocationHandler.invoke(ContextClassLoaderSettingInvocationHandler.java:26) [atlassian-plugins-core-7.1.2.jar:?]
        at com.sun.proxy.$Proxy465.reIndexAll(Unknown Source) [?:?]
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [?:?]
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) [?:?]
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [?:?]
        at java.base/java.lang.reflect.Method.invoke(Method.java:566) [?:?]
        at com.atlassian.plugin.osgi.bridge.external.HostComponentFactoryBean$DynamicServiceInvocationHandler.invoke(HostComponentFactoryBean.java:130) [atlassian-plugins-osgi-bridge-7.1.2.jar:?]
        at com.sun.proxy.$Proxy465.reIndexAll(Unknown Source) [?:?]
        at com.example.sd.impl.JiraServiceDeskImpl.reindex(JiraServiceDeskImpl.java:239) [plugin_12322377452479398274_avsvsrp-plugin_1682977051798.jar:?]
...

However, i do see my log message in the logs:

2023-05-01 21:44:34,166+0000 reindex progress=100 current=null

Right before the NPE. Can someone explain what the uiMessageKeyPercentage or uiMessageKeyCurrent are supposed to be in the progress method and how they relate to the taskProgress and currentSubtask of the TaskProgressSink.

I think this snippet:

  public void updateProgress(final int progress)
  {
    final String message = i18nHelper.getText(uiMessageKeyPercentage, progress);
    final String sub = (StringUtils.isBlank(currentIndex) || StringUtils.isBlank(uiMessageKeyCurrent)) ? null :
        i18nHelper.getText(uiMessageKeyCurrent, currentIndex);
    progressSink.makeProgress(progress, sub, message);
  }

may explain the use for all the arguments to Context.Builder’s progress method. Specifically, the outer args: i18n, uiMessageKeyPercentage, uiMessageKeyCurrent would be used to generate the 3 arguments passed to the progressSink’s makeProgress method.