On 2010-03-02, Stefan Bodewig <bode...@apache.org> wrote:

> On 2010-03-02, Antoine Levy Lambert <anto...@gmx.de> wrote:

>> I have just built ant from trunk and ran the test suite on Windows
>> XP/Cygwin/JDK 1.6.

>> I got this error :

>> Build File:
>> C:\dev\asf\ant-core\src\tests\antunit\taskdefs\import-url-test.xml

>> Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0.313 sec

>> Target: testImportOfNestedFile took 0 sec

>> caused an ERROR

>>                at line 25, column 30

>>                Message: Unable to delete file
>> C:\DOCUME~1\alambert\LOCALS~1\Temp\testoutput\test.jar

> This is what made me add the CloseResources task and I have never seen
> this after svn revision 890827 (but I only run JDK 1.4.1 regularly when
> working on Ant).

It's Java 1.6.  Fails for me as well.

The root problem is that <import> in this test reads from a jar via a
classloader you don't have access to and the jar doesn't get closed
until that classloader is garbage collected at an unknown point in the
future.

With Java 1.4 my CloseResource hack got a handle to the JarFile the
imported file was read from and closed it - this doesn't seem to work on
Java 1.6, most likely the close() doesn't work or you get a different
JarFile than the one that is keeping a lock on the jar.

I'll try to fix the issue by moving the jar out of ${output} (so it
doesn't disturb other tests) and hoping that File.deleteOnExit() works
on it.

Stefan

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@ant.apache.org
For additional commands, e-mail: dev-h...@ant.apache.org

Reply via email to