incubator-odf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Florian Hopf (JIRA)" <>
Subject [jira] [Commented] (ODFTOOLKIT-362) TextSelection.replaceWith() ends in an infinite loop
Date Fri, 19 Jul 2013 11:32:50 GMT


Florian Hopf commented on ODFTOOLKIT-362:

I added two test cases to reproduce this in r1504833.

This seems to be caused by a special handling of cells regarding the replacements. According
to the comments in TextNavigation#createSelection this is to keep display text and string
value of the cells consistent. However, testing this showed that both values are kept consistent
even if the special handling is removed. I am hesitant to remove this code as at least in
some point in time there seemed to be a reason for it and I can't judge if there are any side

For your problem there is a workaround: Instead of calling replace(String) you can pass in
a paragraph, which circumvents the special handling:

TextParagraphElementBase paragraphElement = new TextPElement(doc.getContentDom());
Paragraph para = Paragraph.getInstanceof(paragraphElement);

I agree that the original report is a bug but I'd prefer that one of the original authors
had a look on this. Let us know if the workaround is sufficient for you right now.
> TextSelection.replaceWith() ends in an infinite loop
> ----------------------------------------------------
>                 Key: ODFTOOLKIT-362
>                 URL:
>             Project: ODF Toolkit
>          Issue Type: Bug
>          Components: simple api
>    Affects Versions: odfdom-0.8.7
>            Reporter: Jörg Büsse
>         Attachments:, testTemplate.odt
> Replacing text parts of a table cell can end in an infinite loop. We created a simple
class to reproduce/demonstrate the issue.
> Used libraries:
> odfdom-java-0.8.7.jar
> simple-odf-0.6.6.jar
> Also tried the libraries from odftoolkit-0.5-incubating-bin.tar.gz:
> odfdom-java-0.8.8-incubating.jar
> simple-odf-0.7-incubating.jar

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see:

View raw message