Hi all,

I recognized test failures on my Windows box that I wanted to address
before the release.  One if the failing tests is import-url-test.xml
which fails in the tearDown target because test.jar - from which we
import files - hasn't been closed and thus cannot be deleted.

Quite obviously closing a stream you obtain from a jar:file: URL will
leave the jar file open on Windows (at least using the JDK 1.4 I am
testing with).

My first idea was to copy the close-logic from URLResource over to
FileUtils and use it from ProjectHelper2 so it can close the jar file
explicitly.

Unfortunately this leads to other problems since the underlying classlib
code keeps track of the opened jar files but not of when they get closed
and subsequent attempts to read from a closed jar file will cause
exceptions.

A concrete problem occured in import-url-test.xml itself which failed in
the <jar> task.  ProjectHelper2 would have parsed
org/apache/tools/ant/antlib.xml from ant.jar and closed the
corresponding jar file after that.  The jar task tries to read Ant's
default manifest from the classpath and gets an IllegalStateException
because that ant.jar is already closed.

And there are similiar issues.  The test itself would go ahead and
import more files from the same jar as well as read a properties file -
all these things would fail.

Before going even further - like trying to use separate AntClassLoader
instances that can be cleaned up per imported JAR URL - I thought I
might better ask for ideas.

Maybe the "problem" as I see it really isn't such big a problem since
the same issue should occur for antlibs as well.  Once you've loaded an
antlib, you can't delete the jar file that contained it's descriptor as
long as the Ant process hasn't finished.  Maybe we should document this
to be true for imports from jars as well and be done?

Stefan

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

Reply via email to