Bug 15131 - Junit task fails to correctly set its classpath under Java 1.4
Summary: Junit task fails to correctly set its classpath under Java 1.4
Status: RESOLVED FIXED
Alias: None
Product: Ant
Classification: Unclassified
Component: Optional Tasks (show other bugs)
Version: 1.5
Hardware: PC All
: P3 major with 1 vote (vote)
Target Milestone: 1.6
Assignee: Ant Notifications List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-12-06 04:25 UTC by Samant Maharaj
Modified: 2005-03-20 17:06 UTC (History)
2 users (show)



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Samant Maharaj 2002-12-06 04:25:26 UTC
This is an issue under Java 1.4 when the classpath contains spaces.  I have 
traced this code to JUnitTask.addClasspathEntry().  The call to getClass
().getResource() returns an escaped URL under 1.4 but an unescaped URL under 
1.3.  This means that when run, results such as the following are seen:

    [junit] java.lang.NoClassDefFoundError: 
org/apache/tools/ant/taskdefs/optional/junit/JUnitTestRunner
    [junit] Exception in thread "main"
    [junit] TEST nz.co.orion.audit.AuditLogTest FAILED
    [junit] java.lang.NoClassDefFoundError: 
org/apache/tools/ant/taskdefs/optional/junit/JUnitTestRunner
    [junit] Exception in thread "main"
    [junit] TEST nz.co.orion.discovery.DiscoveryServerTest FAILED
    [junit] java.lang.NoClassDefFoundError: 
org/apache/tools/ant/taskdefs/optional/junit/JUnitTestRunner
    [junit] Exception in thread "main"
    [junit] TEST nz.co.orion.hl7datatype.HL7DataTypeSpecificationTest FAILED
    [junit] java.lang.NoClassDefFoundError: 
org/apache/tools/ant/taskdefs/optional/junit/JUnitTestRunner
    [junit] Exception in thread "main"
    [junit] TEST nz.co.orion.hl7datatype.HL7DataTypeTest FAILED

Debug output reveals:
    [junit] Implicitly adding P:\Resources\Source\Concerto%
20MAP\Concerto\lib\junit.jar;P:\Resources\Source\Concerto%
20MAP\Concerto\lib\ant\ant.jar;P:\Resources\Source\Concerto%
20MAP\Concerto\lib\ant\optional.jar to CLASSPATH
dropping P:\Resources\Source\Concerto%20MAP\Concerto\lib\junit.jar from path as 
it doesn't exist
dropping P:\Resources\Source\Concerto%20MAP\Concerto\lib\ant\ant.jar from path 
as it doesn't exist
dropping P:\Resources\Source\Concerto%20MAP\Concerto\lib\ant\optional.jar from 
path as it doesn't exist

I can confirm that this definitely does not occure when building under JDK 1.3.
Comment 1 Stefan Bodewig 2003-03-31 14:10:49 UTC
should be fixed in nightly build 2003-04-01.