Regression Aspose 13.9.0 <--> 13.5.0

Dear Aspose team,

I tried the new version 13.9.0 instead of 13.5.0 because we neeed as solution for WORDSJAVA-738.

Unfortunately I got a ClassCastException in the code, given by you here:
https://docs.aspose.com/words/java/update-field/

java.lang.ClassCastException: com.aspose.words.FieldSeparator cannot be cast to com.aspose.words.Run
at ch.abacus.publ.common.lib.wordmailmerge.WordMergeField.setName(WordMergeField.java:55)

Is there any solution for version 13.9.0?

Thanks a lot!

Kind regards

Hi Jens,

Thanks for your inquiry. After an initial test with Aspose.Words for Java 13.9.0, I was unable to reproduce this exception on my side. Please see the input/output word documents which I used on my end for testing. Could you please attach your input Word document you’re getting this problem with here for testing? I will investigate the issue further on my side and provide you more information.

Best regards,

Hi Awais,

thanks a lot for your reply. I performed further tests. I extracted the getFields() method from our code to a junit testclass with which I couldnt reproduce the behaviour. But then our original tests runs too.

So I changed back the aspose version to 13.5.0 and the original tests failed with

java.lang.RuntimeException: Cannot find field separator.
at ch.abacus.publ.common.lib.wordmailmerge.WordMergeField.(WordMergeField.java:46)

So I assume that there are persistant settings written by the aspose library?

We do have multiple versions on which we are using 13.5.0. On each I could reproduce the exception I mentioned in my first post here after changing to 13.9.0. On each the exception was gone, after I ran the extracted junit test. The only difference between productive code and the extracted code is that no licence check is performed.

I attached the document which leads to the first exception

Hi Jens,

Thanks for the additional information. I am checking with this scenario and will get back to you soon.

Best regards,

Hi Jens,

Thank you for being patient. I am afraid, I was still unable to reproduce this exception on my side. I have attached output document (out13.10.0.doc) here for your reference. I used Aspose.Words for Java 13.10.0 and the following simple code to generate the attached document on my side:

Document doc = new Document("C:\Temp\testTemplateRegions.doc");
NodeCollection fieldStarts = doc.getChildNodes(NodeType.FIELD_START, true);

for (FieldStart fieldStart : (Iterable<FieldStart>)fieldStarts)
{
    if (fieldStart.getFieldType() == FieldType.FIELD_MERGE_FIELD)
    {
        MergeField mergeField = new MergeField(fieldStart);
        mergeField.setName(mergeField.getName().replace("#", ""));
    }
}
doc.save("C:\Temp\out13.10.0.doc");

Please create a simple standalone/runnable application (for example a Java Console Application Project) that helps me reproduce the same exception on my end and attach it here for testing. Also, please tell us the details of the development environment (e.g. JDK version, OS version) of the machine you’re getting this exception on. As soon as you get these pieces of information to me I’ll start further investigation into your issue.

Best regards,

Hi Awais,

thank you for your effort. It seems there is a rebuilding/refreshing/caching problem of our IDE. Everytime I change some code the tests run not matter which aspose version.
So I apologize for the additional work.

Best regards,

Hi Jens.

Please let us know if you have any troubles with Aspose.Words for Java and we will be glad to look into this further for you.

Best regards,