Bug 102300 - RemoteAntBuildListener throws exception for jspc task
Summary: RemoteAntBuildListener throws exception for jspc task
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Ant (show other bugs)
Version: 3.1   Edit
Hardware: Sun Solaris
: P3 normal with 1 vote (vote)
Target Milestone: 3.1.2   Edit
Assignee: Kevin Barnes CLA Friend
QA Contact:
URL:
Whiteboard:
Keywords:
: 104217 120181 129313 130310 149231 (view as bug list)
Depends on:
Blocks:
 
Reported: 2005-06-30 07:34 EDT by Stephen Booth CLA Friend
Modified: 2006-06-29 18:30 EDT (History)
7 users (show)

See Also:


Attachments
simple project demonstrating the problem (1.18 KB, application/zip)
2005-07-12 07:56 EDT, Stephen Booth CLA Friend
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Stephen Booth CLA Friend 2005-06-30 07:34:31 EDT
I have a jspc task in my ant script to do a test compile of jsp pages
This worked under 3.0 but I get an exception to stdout under 3.1

java.lang.StringIndexOutOfBoundsException: String index out of range: -1
        at java.lang.String.substring(String.java:1444)
        at org.eclipse.ant.internal.ui.AntUtil.getLocationLink(AntUtil.java:491)
        at
org.eclipse.ant.internal.ui.launchConfigurations.RemoteAntBuildListener.generateLink(RemoteAntBuildListener.java:255)
        at
org.eclipse.ant.internal.ui.launchConfigurations.RemoteAntBuildListener.receiveTaskMessage(RemoteAntBuildListener.java:243)
        at
org.eclipse.ant.internal.ui.launchConfigurations.RemoteAntBuildListener.receiveMessage(RemoteAntBuildListener.java:173)
        at
org.eclipse.ant.internal.ui.launchConfigurations.RemoteAntBuildListener$ServerConnection.run(RemoteAntBuildListener.java:104)


Ant file that produces the same bug looks like:

<project name="Example" default="prepare" basedir=".">
	<target name="prepare">
	<mkdir dir="${basedir}/work/org/apache/jsp" />
	<jspc srcdir="${basedir}" destdir="${basedir}/work/org/apache/jsp"
package="org.apache.jsp"  >
		<include name="*.jsp" />
	</jspc>
</target>
</project>
Comment 1 Darin Swanson CLA Friend 2005-07-07 13:21:59 EDT
Thank you for the bug report.
Can you provide a sample of the output that is causing the exception.
With my quick tests I have been unable to reproduce the exception.
Comment 2 Stephen Booth CLA Friend 2005-07-12 07:56:27 EDT
Created attachment 24596 [details]
simple project demonstrating the problem

I have uploaded a small project that demonstrates the bug for me.
Invoke the build.xml file.
I get only part of the console output then a stack trace to the terminal window
where I started eclipse.
Comment 3 Darin Swanson CLA Friend 2005-07-18 13:06:58 EDT
*** Bug 104217 has been marked as a duplicate of this bug. ***
Comment 4 Calvin R. Smith CLA Friend 2005-08-12 14:15:19 EDT
I ran into this and 'fixed' it by adding a (if index == -1) return null; on the
line prior to 491

the only thing weird I did was replace the default ANT_HOME with one from my project
Comment 5 Calvin R. Smith CLA Friend 2005-08-17 14:20:55 EDT
ok some more info

my project has a custom ant task to do the compiling I get the exception when
eclipse tries to build a link (so that I can click on the task name and have the
source brought up)
the getLocationLink is supposed to be called with filename:line number
but I only get filename
the code looks backwards for the : and converts everything after it to a number
on windows the exception is not seen but the link is not built either, the
reason for this is that the paramter is:
c:\project\srs\a\a.java
so it parses the paramter to:
filename: c
line number: \project\srs\a\a.java
then the line number is converted to a number which of course fails and the
thrown excpetion is caught and null is returned.  end result is on windows the
exception is not seen but the link not there
with my fix I handle the case of no : found and return null thus causing the
same result
someone that knows eclipse ant needs to test this on a unix platform and find a
better fix, but till then my fix is better than what is there now
Comment 6 James Olsen CLA Friend 2005-09-07 11:34:42 EDT
I'm having the same symptoms on Unix (Mac OS X) with the xmlbean custom task.  The console stops 
printing the ant build progress although the build appears to continue.  Of course I don't know what it's 
doing from that point forwards.  This occurs with Version: 3.1.0 Build id: I20050627-1435 but didn't with 
3.0 using exact same build file.
Comment 7 Darin Swanson CLA Friend 2005-10-03 23:49:02 EDT
I did some rework in AntUtil to handle this case and to bail less expensively: 
no linenumber no need to go look for a file.
Comment 8 Darin Swanson CLA Friend 2005-10-03 23:49:28 EDT
Please verify Kevin et al
Comment 9 Kevin Barnes CLA Friend 2005-10-04 12:46:44 EDT
verified
Comment 10 Jim McMaster CLA Friend 2005-12-10 21:20:13 EST
*** Bug 120181 has been marked as a duplicate of this bug. ***
Comment 11 Darin Swanson CLA Friend 2005-12-10 23:51:03 EST
I would like to propose this a potential bug for 3.1.2
Comment 12 Darin Wright CLA Friend 2005-12-12 09:07:54 EST
Marking as 3.1.2 candidate
Comment 13 Darin Swanson CLA Friend 2006-01-02 19:55:32 EST
Changes released for AntUtil in the 3.1 maintenance stream.
Map updated as well for maintenance stream build.
Comment 14 Darin Swanson CLA Friend 2006-01-02 19:56:55 EST
Please verify Kevin.
Comment 15 Kevin Barnes CLA Friend 2006-01-09 15:11:27 EST
verified
Comment 16 Darin Swanson CLA Friend 2006-02-24 10:10:43 EST
*** Bug 129313 has been marked as a duplicate of this bug. ***
Comment 17 Darin Swanson CLA Friend 2006-03-06 01:20:21 EST
*** Bug 130310 has been marked as a duplicate of this bug. ***
Comment 18 Darin Swanson CLA Friend 2006-06-29 18:30:09 EDT
*** Bug 149231 has been marked as a duplicate of this bug. ***