ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 5823] New: - NullPointerException when JUnit sample tests are run with Ant
Date Sat, 12 Jan 2002 09:33:58 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=5823>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=5823

NullPointerException when JUnit sample tests are run with Ant

           Summary: NullPointerException when JUnit sample tests are run
                    with Ant
           Product: Ant
           Version: 1.4.1
          Platform: Other
        OS/Version: Windows 9x
            Status: NEW
          Severity: Minor
          Priority: Other
         Component: Optional Tasks
        AssignedTo: ant-dev@jakarta.apache.org
        ReportedBy: demi62234@yahoo.com


You may not consider this a bug, but it is worth noting.

When I run the sample tests supplied with JUnit as an Ant task I get a 
NullPointerException from the StackFilterTest.  I believe the cause is that the 
StackFilterTest calls the static method BaseTestRunner.filterStack() which in 
turn calls BaseTestRunner.getPreference() which attempts to access a static 
Properties object.  However, the static Properties object is instantiated in a 
(non-static) instance initializer of BaseTestRunner.  This does not cause a 
problem when accessed via JUnit's TestRunner because TestRunner extends 
BaseTestRunner, hence the initialization occurs.  However, Ant uses 
JUnitTestRunner to run the tests so the instance initialization of 
BaseTestRunner never takes place.

Anyway, that is what I think is happening.  This caused me a lot of confusion 
when trying to get Ant and JUnit working together. I guess the proper fix would 
be for the JUnit folks to instantiate the Properties object in a static 
intitialization block of BaseTestRunner. But most people will think the problem 
is with Ant, so I thought I would mention it here.

Mark Dematteis

--
To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>


Mime
View raw message