During a reindexing process on a table where records fail to be found by global search, a null pointer exception may be thrown by the CurrencyPriceOptimizer when calling GlideRecord.next():
Steps to Reproduce
The exact steps to reproduce are not available. This issue was found after starting a 'Regenerate Text Index' job, that failed several times due to the null pointer exception. The reindexing was required by a global text search run on task numbers not returning the expected task records.
If the task number values fail to get indexed, then the exact match search will not find them when using the latest global search engine. However, the legacy global search will still find a record that is not indexed.
This could be significant if you had a backlog of text index events. You would still want the exact match to find the record while we wait for the record to get indexed, and since the purpose of exact match is to avoid a text search, it should not matter if the record is not yet indexed.
This problem was fixed since Jakarta Patch 9. As a workaround on older versions, you can disable the code path that generates the NullPointerException by disabling the optimizer setting the system property as follows:
glide.currency_price_optimizer.enabled = false
This might affect performance when the related table has a currency field, however it will avoid the NullPointerException.
After that, reindexing the table that has generated the issue will be necessary. If possible, you can disable text_index on one of the columns to reduce memory usage.
Related Problem: PRB1248691