[ ant-contrib-Bugs-1731315 ] StringIndexOutOfBoundsException

"SourceForge.net" <[email protected]>
Newsgroups gmane.comp.java.ant-contrib.devel
Message-ID <[email protected]>
Bugs item #1731315, was opened at 2007-06-05 04:33
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=416920&aid=1731315&group_id=36177

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: cpptasks
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Nobody/Anonymous (nobody)
Assigned to: Curt Arnold (carnold)
Summary: StringIndexOutOfBoundsException

Initial Comment:
cpptask throws an StringIndexOutOfBoundsException
in net.sf.antcontrib.cpptasks.types.LibrarySet.setLibs(LibrarySet.java:176)
whenever a lib with a name shorter than 3 characters 
is specified in a libset.

To reproduce:
<target ...>
  <cc ...>
    ...
    <libset libs="dv"/>
    ...
  </cc>
</target>

The offending code line is (LibrarySet.java:176):

  if (libnames[i].substring(0,3).equalsIgnoreCase("lib")) {

which assumes a minimal name length of 3. This is nonsense since there are numerous libraries whose main name is only one or 2 characters long (e.g. libGL.so, libz.so, ...).

Either omit the check (since what happens with liblib.so ???) or use:
  if (libnames[i].toLowerCase().startsWith("lib")) {





----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=416920&aid=1731315&group_id=36177

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.