[ ant-contrib-Bugs-1731315 ] StringIndexOutOfBoundsException

"SourceForge.net" <[email protected]> Wed, 22 Aug 2007 16:53:28 -0700
Newsgroups gmane.comp.java.ant-contrib.devel
Message-ID <[email protected]>
Bugs item #1731315, was opened at 2007-06-05 11:33
Message generated for change (Comment added) made by darius42
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: Closed
>Resolution: Works For Me
Priority: 5
Private: No
Submitted By: Nobody/Anonymous (nobody)
>Assigned to: David Haney (darius42)
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")) {





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

>Comment By: David Haney (darius42)
Date: 2007-08-22 23:53

Message:
Logged In: YES 
user_id=1140024
Originator: NO

Closing as this does not appear to be an issue in the current code base.

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

Comment By: David Haney (darius42)
Date: 2007-08-17 20:45

Message:
Logged In: YES 
user_id=1140024
Originator: NO

This doesn't appear to be an issue in the current code base.

The current code for LibrarySet doesn't have the line referenced above,
and the test suite for LibrarySet has a test verifying that short names are
handled correctly (based on the comments the test was added in 2002).

What version of the code was this problem discovered in?

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

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: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/