StringIndexOutOfBoundsException in TextUtilities.java

A discussion forum for the JCommon class library.
Post Reply
ChristianGiacomi

StringIndexOutOfBoundsException in TextUtilities.java

Post by ChristianGiacomi » Tue Nov 22, 2005 1:58 pm

Hi all I am posting this to know if anyone has suffered the same problem.

In the TextUtilities.java line number 250

Code: Select all

while (text.charAt(current) == '\n' && current < text.length()) {
    current++;
}


I had to inverse the tests because if 'current' is greater than text.length(), text.charAt(current) is called, thus throwing the exception 'StringIndexOutOfBoundsException'

like so...

Code: Select all

while (current < text.length() && text.charAt(current) == '\n') {
    current++;
}


Like this I do not run into the problem. :roll:
Well maybe you knew about it... just wanted to let you know in case you did not.

cheers,
Christian Giacomi

Taqua
JFreeReport Project Leader
Posts: 698
Joined: Fri Mar 14, 2003 3:34 pm
Contact:

Post by Taqua » Tue Nov 22, 2005 11:38 pm

Hi,

we were not aware of that bug (leaving known bugs unfixed is considered impolite :)). Thanks for the report - the fix is now in the CVS.

Regards,
Thomas

ChristianGiacomi

Post by ChristianGiacomi » Fri Nov 25, 2005 3:40 pm

:D Glad to be of help...

Thank you (and all those who particapate) for the incredible work.

Post Reply