Hi Sonam,
Thanks for sharing the detail of your issue.
Please make sure that you are using the latest version of Aspose.Words for Java 14.4.1. Please try following line for code at your side and let us know if you still face any issue.
run.toString(com.aspose.words.SaveFormat.TEXT).trim().isEmpty()
You can also use run.getText().trim().isEmpty().
Hope this helps you.