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=28474>.
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=28474

JUnitResultFormatter throws BuildException due to classloading issues 

           Summary: JUnitResultFormatter throws BuildException due to
                    classloading issues
           Product: Ant
           Version: 1.6.0
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Optional Tasks
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


In case of loading junit task and junit.jar with its own clasloader (using
taskdef) and junit runs inJVM (no fork) an exception occurs:

-----------------------------------------------------------------------------
org.apache.tools.ant.taskdefs.optional.junit.PlainJUnitResultFormatter is not a
JUnitResultFormatter
        at
org.apache.tools.ant.taskdefs.optional.junit.FormatterElement.createFormatter(FormatterElement.java:254)
        at
org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.executeInVM(JUnitTask.java:987)
        at
org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.execute(JUnitTask.java:663)
        at
org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.execute(JUnitTask.java:637)
-------------CUT -----------------

The reason should be in line 253 of FormatterElement.java:

253:        if (!(o instanceof JUnitResultFormatter)) {
254:            throw new BuildException(classname
255:                + " is not a JUnitResultFormatter");
256:        }

JUnitResultFormatter and o will be loaded by different classloaders in the
described scenario.

Setting fork to true will be a workaround.

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

Reply via email to