Comments crash - urgent

Hi support,

Please note that you cannot add any comment object with the latest Aspose.Words for Java (the one from 10/19/2008). You can test this by running the example from documentation:

Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.write("Some text is added.");

Comment comment = new Comment(doc);
builder.getCurrentParagraph().appendChild(comment);
comment.getParagraphs().add(new Paragraph(doc));
comment.getFirstParagraph().getRuns().add(new Run(doc, "Comment text."));
doc.save("C:\Temp\docCommentsExampleFromDocumentation.doc");

Please advice.
Regards,
Milan

Hi
Thanks for your inquiry. This is known issue #4346 in our defect database. This issue is already fixed in .NET version of Aspose.Words and next java release will also contain this fix.
You can also easy fix this on your side. Just set Comment.Author and Comment.Initial properties to non null values. The problem was caused by null author and initials. Please see the following code:

Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.write("Some text is added.");
Comment comment = new Comment(doc);
builder.getCurrentParagraph().appendChild(comment);
comment.getParagraphs().add(new Paragraph(doc));
comment.getFirstParagraph().getRuns().add(new Run(doc, "Comment text."));
comment.setAuthor("");
comment.setInitial("");
doc.save("C:\\Temp\\out.doc");

Hope this helps.
Best regards.

Thank you very much for your fast answer. The workaround solves the issue.
Best regards,
Milan