IReplacingCallback returns nullpointer exception

Hi,
we are calling the replace function for a regex.

FindReplaceOptions options = new FindReplaceOptions();
options.setDirection(FindReplaceDirection.FORWARD);
options.setReplacingCallback(new ReplaceEvaluator(documentConfigDetailRepository, json, baseAsposeDocument, counterparty, entity, layout, jdbcTemplate));
baseAsposeDocument.getRange().replace(Pattern.compile("\\{\\{([^}]*)\\}\\}"), "", options);

In the ReplaceEvaluator the ReplacingArgs is replaced with " ".

args.setReplacement(" ");
return ReplaceAction.REPLACE;

This throws a null pointer exception as the parent cannot be found.

@arunavayyala Could you please attach your source document here for testing? We will check the scenario on our side and provide you more information.
Also, please try using

options.setDirection(FindReplaceDirection.BACKWARD);

instead of

options.setDirection(FindReplaceDirection.FORWARD);
1 Like

@alexey.noskov Thank you for your reply. It works when changed to BACKWARD.

1 Like