You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by Erez Eisenstein <EE...@axismobile.com> on 2006/11/22 11:40:32 UTC

PPT/POI - RichTextRun - java.lang.StringIndexOutOfBoundsException - method getText()

Hi Nick & Yegor.

When I invoke the method
org.apache.poi.hslf.usermodel.RichTextRun.getText() I get an exception -
StringIndexOutOfBoundsException.

I can see that the length member of this instance has a very big value
(1572863), while the getText() method of the TextRun returns a shorter
String (55).

Any ideas why this happens? Or how to fix or avoid this?

Thanks.

---------------------------------------------------------------------
To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
Mailing List:     http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta Poi Project:  http://jakarta.apache.org/poi/


Re: PPT/POI - RichTextRun - java.lang.StringIndexOutOfBoundsException - method getText()

Posted by Nick Burch <ni...@torchbox.com>.
On Wed, 22 Nov 2006, Erez Eisenstein wrote:
> When I invoke the method
> org.apache.poi.hslf.usermodel.RichTextRun.getText() I get an exception -
> StringIndexOutOfBoundsException.
>
> I can see that the length member of this instance has a very big value
> (1572863), while the getText() method of the TextRun returns a shorter
> String (55).

Looks like you have a StyleTextProp atom, which claims you have a Rich 
Text Run, which is longer than the underlying text atom has text for

The snag is that the code for building RichTextRuns from a 
StyleTextPropAtom and a text atom is pretty complicated already, and 
assumes that the text lengths will be correct. Updating it to handle the 
case when the StyleTextPropAtom lies about the length isn't going to be 
fun :(


If you could upload the problem file to bugzilla, then I can maybe take a 
look the next time I want a frustraiting challenge....

Nick


---------------------------------------------------------------------
To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
Mailing List:     http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta Poi Project:  http://jakarta.apache.org/poi/