You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by Thorsten Bux <Th...@gmx.de> on 2008/08/25 16:39:10 UTC

Multible calls of TextRun.changeTextInRichTextRun causes Exception

Hi,

I try to update RichTextRun-Objects in a TextRun-Object.

When I call TextRun.changeTextInRichTextRun(RichTextRun[0],"") the first time everything works fine. But when I call it a second time TextRun.changeTextInRichTextRun(RichTextRun[1],"Hello") I get the following Exception:

Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: 68
	at java.lang.String.substring(Unknown Source)
	at org.apache.poi.hslf.usermodel.RichTextRun.getRawText(RichTextRun.java:158)
	at org.apache.poi.hslf.model.TextRun.changeTextInRichTextRun(TextRun.java:435)
	at substitutionClassesForPptParser.SimpleSubstitution.handeSubstitution(SimpleSubstitution.java:99)
	at methodsFromPptParser.ProcessPptDocumet.importPlaceholder(ProcessPptDocumet.java:94)
	at Tester.main(Tester.java:16)


I try something like that.

RichTextRun[0] --> "Hello"
RichTextRun[1] --> "World"
RichTextRun[2] --> "POI"


TextRun.changeTextInRichTextRun(RichTextRun[0], "");
TextRun.changeTextInRichTextRun(RichTextRun[1], "Java");
TextRun.changeTextInRichTextRun(RichTextRun[0], "Apache");

Can anyone please help me.

Thanks
Thorsten

-- 
Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen! 
Ideal für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


Re: Multible calls of TextRun.changeTextInRichTextRun causes Exception

Posted by Yegor Kozlov <ye...@dinom.ru>.
https://issues.apache.org/bugzilla/

You will need to register first. Then follow the "Enter a new bug report" link.

Yegor

> Hi,
> 
> I have no idea how to open a bug in Bugzilla, sorry. Is there a HowTo anywhere.
> 
> Thorsten
> -------- Original-Nachricht --------
>> Datum: Mon, 25 Aug 2008 18:44:11 +0400
>> Von: Yegor Kozlov <ye...@dinom.ru>
>> An: POI Users List <us...@poi.apache.org>
>> Betreff: Re: Multible calls of TextRun.changeTextInRichTextRun causes Exception
> 
>> Can you open a bug in bugzilla and post a sample code to reproduce the
>> problem?
>> Ideally, it would be a failing unit test.
>>
>> Yegor
>>
>>> Hi,
>>>
>>> I try to update RichTextRun-Objects in a TextRun-Object.
>>>
>>> When I call TextRun.changeTextInRichTextRun(RichTextRun[0],"") the first
>> time everything works fine. But when I call it a second time
>> TextRun.changeTextInRichTextRun(RichTextRun[1],"Hello") I get the following Exception:
>>> Exception in thread "main" java.lang.StringIndexOutOfBoundsException:
>> String index out of range: 68
>>> 	at java.lang.String.substring(Unknown Source)
>>> 	at
>> org.apache.poi.hslf.usermodel.RichTextRun.getRawText(RichTextRun.java:158)
>>> 	at
>> org.apache.poi.hslf.model.TextRun.changeTextInRichTextRun(TextRun.java:435)
>>> 	at
>> substitutionClassesForPptParser.SimpleSubstitution.handeSubstitution(SimpleSubstitution.java:99)
>>> 	at
>> methodsFromPptParser.ProcessPptDocumet.importPlaceholder(ProcessPptDocumet.java:94)
>>> 	at Tester.main(Tester.java:16)
>>>
>>>
>>> I try something like that.
>>>
>>> RichTextRun[0] --> "Hello"
>>> RichTextRun[1] --> "World"
>>> RichTextRun[2] --> "POI"
>>>
>>>
>>> TextRun.changeTextInRichTextRun(RichTextRun[0], "");
>>> TextRun.changeTextInRichTextRun(RichTextRun[1], "Java");
>>> TextRun.changeTextInRichTextRun(RichTextRun[0], "Apache");
>>>
>>> Can anyone please help me.
>>>
>>> Thanks
>>> Thorsten
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
>> For additional commands, e-mail: user-help@poi.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


RE: Multible calls of TextRun.changeTextInRichTextRun causes Exception

Posted by "Dobson, Paul L CTR USAF AFMC 416 SCMS/OBN" <Pa...@HILL.af.mil>.
I went through the same thing a few weeks ago.   I think I went to
https://issues.apache.org/bugzilla/

>From there I created a new account.  You can look for a link to "new" to
create a new link.

Not exactly a "how to" but hopefully it points you in the right
direction.

-----Original Message-----
From: Thorsten Bux [mailto:ThorstenBux@gmx.de] 
Sent: Monday, August 25, 2008 8:49 AM
To: POI Users List
Subject: Re: Multible calls of TextRun.changeTextInRichTextRun causes
Exception

Hi,

I have no idea how to open a bug in Bugzilla, sorry. Is there a HowTo
anywhere.

Thorsten
-------- Original-Nachricht --------
> Datum: Mon, 25 Aug 2008 18:44:11 +0400
> Von: Yegor Kozlov <ye...@dinom.ru>
> An: POI Users List <us...@poi.apache.org>
> Betreff: Re: Multible calls of TextRun.changeTextInRichTextRun causes
Exception

> Can you open a bug in bugzilla and post a sample code to reproduce the
> problem?
> Ideally, it would be a failing unit test.
> 
> Yegor
> 
> > Hi,
> > 
> > I try to update RichTextRun-Objects in a TextRun-Object.
> > 
> > When I call TextRun.changeTextInRichTextRun(RichTextRun[0],"") the
first
> time everything works fine. But when I call it a second time
> TextRun.changeTextInRichTextRun(RichTextRun[1],"Hello") I get the
following Exception:
> > 
> > Exception in thread "main"
java.lang.StringIndexOutOfBoundsException:
> String index out of range: 68
> > 	at java.lang.String.substring(Unknown Source)
> > 	at
>
org.apache.poi.hslf.usermodel.RichTextRun.getRawText(RichTextRun.java:15
8)
> > 	at
>
org.apache.poi.hslf.model.TextRun.changeTextInRichTextRun(TextRun.java:4
35)
> > 	at
>
substitutionClassesForPptParser.SimpleSubstitution.handeSubstitution(Sim
pleSubstitution.java:99)
> > 	at
>
methodsFromPptParser.ProcessPptDocumet.importPlaceholder(ProcessPptDocum
et.java:94)
> > 	at Tester.main(Tester.java:16)
> > 
> > 
> > I try something like that.
> > 
> > RichTextRun[0] --> "Hello"
> > RichTextRun[1] --> "World"
> > RichTextRun[2] --> "POI"
> > 
> > 
> > TextRun.changeTextInRichTextRun(RichTextRun[0], "");
> > TextRun.changeTextInRichTextRun(RichTextRun[1], "Java");
> > TextRun.changeTextInRichTextRun(RichTextRun[0], "Apache");
> > 
> > Can anyone please help me.
> > 
> > Thanks
> > Thorsten
> > 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
> For additional commands, e-mail: user-help@poi.apache.org

-- 
GMX startet ShortView.de. Hier findest Du Leute mit Deinen Interessen!
Jetzt dabei sein:
http://www.shortview.de/wasistshortview.php?mc=sv_ext_mf@gmx

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


Re: Multible calls of TextRun.changeTextInRichTextRun causes Exception

Posted by Thorsten Bux <Th...@gmx.de>.
Hi,

I have no idea how to open a bug in Bugzilla, sorry. Is there a HowTo anywhere.

Thorsten
-------- Original-Nachricht --------
> Datum: Mon, 25 Aug 2008 18:44:11 +0400
> Von: Yegor Kozlov <ye...@dinom.ru>
> An: POI Users List <us...@poi.apache.org>
> Betreff: Re: Multible calls of TextRun.changeTextInRichTextRun causes Exception

> Can you open a bug in bugzilla and post a sample code to reproduce the
> problem?
> Ideally, it would be a failing unit test.
> 
> Yegor
> 
> > Hi,
> > 
> > I try to update RichTextRun-Objects in a TextRun-Object.
> > 
> > When I call TextRun.changeTextInRichTextRun(RichTextRun[0],"") the first
> time everything works fine. But when I call it a second time
> TextRun.changeTextInRichTextRun(RichTextRun[1],"Hello") I get the following Exception:
> > 
> > Exception in thread "main" java.lang.StringIndexOutOfBoundsException:
> String index out of range: 68
> > 	at java.lang.String.substring(Unknown Source)
> > 	at
> org.apache.poi.hslf.usermodel.RichTextRun.getRawText(RichTextRun.java:158)
> > 	at
> org.apache.poi.hslf.model.TextRun.changeTextInRichTextRun(TextRun.java:435)
> > 	at
> substitutionClassesForPptParser.SimpleSubstitution.handeSubstitution(SimpleSubstitution.java:99)
> > 	at
> methodsFromPptParser.ProcessPptDocumet.importPlaceholder(ProcessPptDocumet.java:94)
> > 	at Tester.main(Tester.java:16)
> > 
> > 
> > I try something like that.
> > 
> > RichTextRun[0] --> "Hello"
> > RichTextRun[1] --> "World"
> > RichTextRun[2] --> "POI"
> > 
> > 
> > TextRun.changeTextInRichTextRun(RichTextRun[0], "");
> > TextRun.changeTextInRichTextRun(RichTextRun[1], "Java");
> > TextRun.changeTextInRichTextRun(RichTextRun[0], "Apache");
> > 
> > Can anyone please help me.
> > 
> > Thanks
> > Thorsten
> > 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
> For additional commands, e-mail: user-help@poi.apache.org

-- 
GMX startet ShortView.de. Hier findest Du Leute mit Deinen Interessen!
Jetzt dabei sein: http://www.shortview.de/wasistshortview.php?mc=sv_ext_mf@gmx

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


Re: Multible calls of TextRun.changeTextInRichTextRun causes Exception

Posted by Yegor Kozlov <ye...@dinom.ru>.
Can you open a bug in bugzilla and post a sample code to reproduce the problem?
Ideally, it would be a failing unit test.

Yegor

> Hi,
> 
> I try to update RichTextRun-Objects in a TextRun-Object.
> 
> When I call TextRun.changeTextInRichTextRun(RichTextRun[0],"") the first time everything works fine. But when I call it a second time TextRun.changeTextInRichTextRun(RichTextRun[1],"Hello") I get the following Exception:
> 
> Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: 68
> 	at java.lang.String.substring(Unknown Source)
> 	at org.apache.poi.hslf.usermodel.RichTextRun.getRawText(RichTextRun.java:158)
> 	at org.apache.poi.hslf.model.TextRun.changeTextInRichTextRun(TextRun.java:435)
> 	at substitutionClassesForPptParser.SimpleSubstitution.handeSubstitution(SimpleSubstitution.java:99)
> 	at methodsFromPptParser.ProcessPptDocumet.importPlaceholder(ProcessPptDocumet.java:94)
> 	at Tester.main(Tester.java:16)
> 
> 
> I try something like that.
> 
> RichTextRun[0] --> "Hello"
> RichTextRun[1] --> "World"
> RichTextRun[2] --> "POI"
> 
> 
> TextRun.changeTextInRichTextRun(RichTextRun[0], "");
> TextRun.changeTextInRichTextRun(RichTextRun[1], "Java");
> TextRun.changeTextInRichTextRun(RichTextRun[0], "Apache");
> 
> Can anyone please help me.
> 
> Thanks
> Thorsten
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org