DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUGĀ·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=35987>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED ANDĀ·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=35987

           Summary: <presetdef name="java"> breaks <jspc>
           Product: Ant
           Version: 1.6.5
          Platform: All
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Optional Tasks
        AssignedTo: dev@ant.apache.org
        ReportedBy: [EMAIL PROTECTED]


If I add a presetdef for java, then the jspc task breaks. There may be a few 
other optional tasks that break due to this.

Notice that the output below does not contain much in the way of information 
for diagnosing the problem. I put the log level to debug and I still didn't get 
much in the way of information.

Note: I have since worked around the problem in my build.

------------------------------------------------------------------
Investigation
------------------------------------------------------------------

After a little investigation it turns out that JasperC.java attempts to create 
the "java" task:
   Java java = (Java) (getProject().createTask("java"));

A bit further on in ComponentHelper.java we end up with a ClassCastException on 
the following line:
   Task task = (Task) createComponent(taskType);

createComponent returns a PreSetDef$PreSetDefinition which can not be casted to 
a Task.

This bug is similar to: http://issues.apache.org/bugzilla/show_bug.cgi?id=33433

BTW, debugging the code showed that there is a field called "cause" with the 
same name in BuildException as the Throwable base class. I don't know if this 
will cause confusion.

------------------------------------------------------------------
Output
------------------------------------------------------------------

Buildfile: build.xml

all:
Trying to override old definition of task java
     [jspc] Compiling 1 source fileD:\antBug\build

BUILD FAILED
D:\antBug\build.xml:23: Error running jsp compiler:

Total time: 1 second

------------------------------------------------------------------
build.xml
------------------------------------------------------------------

<?xml version="1.0"?>
<project name="test" default="all" basedir=".">

<target name="all">
<!-- Comment out the PresetDef to get the jspc task working.-->
        <presetdef name="java">
                <java failonerror="${failonerror}"/>
        </presetdef>

        <mkdir dir="src"/>
        <mkdir dir="build"/>
        <mkdir dir="classes"/>
        <touch file="src/test.jsp"/>

        <property name="classesDir" location="classes"/>

        <path id="jsp.classpath">
                <pathelement 
                        location="${classesDir}/org.apache.jasper.jar"/>
                <pathelement location="${classesDir}/javax.servlet.jar"/>
        </path>

        <jspc   srcdir="src"
                destdir="build">
                <classpath refid="jsp.classpath"/>
                <include name="**\/*.jsp" />
        </jspc>
</target>

</project>

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to