[Bug 944546] [NEW] StringIndexOutOfBoundsException in HelpFormatter.findWrapPos
944546 at bugs.launchpad.net
Fri Mar 2 04:35:40 UTC 2012
Public bug reported:
This bug has been fixed upstream in version 1.3 Could you look at
backporting this fix or updating to the latest version?
"You should be able to get it to throw with a call like this:
findWrapPos( "hello", 3, 0 ); // should return -1
The exception gets thrown whenever the passed-in string does not contain
any spaces, tabs, or newlines. It looks like line 914 was also expecting
line 908 to have a <.
Also, I think there are other bugs. In this call:
findWrapPos( "helloooo\noo\ngoodbye", 6, 7 ); // should return 8
we want it to short circuit and return the first newline if there is one
in the substring starting at 7 with width 6 ("o\noo\ng"), and so it
should return the index of the first '\n', which is 8. However, on lines
876 and 877, it's doing "pos <= width", instead of "pos <=
startPos+width", so it won't return, and it will end up (incorrectly, I
think) returning the index of the second newline's position. And once
you fix lines 876 and 877, it's going to return 9 instead of 8, which I
think is incorrect. The other return statements return pos, not pos+1,
and I think line 879 should do the same."
** Affects: libcommons-cli-java (Ubuntu)
You received this bug notification because you are a member of Ubuntu
Server Team, which is subscribed to libcommons-cli-java in Ubuntu.
StringIndexOutOfBoundsException in HelpFormatter.findWrapPos
To manage notifications about this bug go to:
More information about the Ubuntu-server-bugs