You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by Stefan Bodewig <bo...@apache.org> on 2010/09/27 16:49:42 UTC

Re: svn commit: r1001756 - in /ant/core/trunk: WHATSNEW src/main/org/apache/tools/ant/helper/ProjectHelper2.java src/main/org/apache/tools/ant/launch/Locator.java src/tests/antunit/taskdefs/taskdef-test.xml

On 2010-09-27, <bo...@apache.org> wrote:

> according to the javadocs of JarURLConnection the separator is !/ not
> ! - this allows dealing with jars in directories that contain a ! in
> their name, as long as it is not at the end of the directory name.

This deals with splitting jar:file:somwhere/jar.file!/some/resource into
the jar's URL and the relative resource.  We used to split at
indexOf("!") and the code now splits at indexOf("!/") which is the
official separator.

Two things to note:

 (1) there is a disabled testcase for when "somewhere" in the URL above
   ends with a "!".  Classloader.getResources("something") happily
   returns an URL that JarURLConnection cannot deal with - it looks as
   if Sun's code was performing the same naive indexOf("!/") that our
   code now uses.

   I'm not conviced that we can fix that (we could try to figure out the
   file part in special cases like the <taskdef> test and perform
   %-escaping if that works) or that we even want to.

 (2) The new tests create JARs that will be loaded by a classloader -
   which means Ant cannot delete them because they remain locked until
   the JVM has exited.  This means the tests accumulate a lot of garbage
   in ${TEMP} over time.

Stefan

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


Re: svn commit: r1001756 - in /ant/core/trunk: WHATSNEW src/main/org/apache/tools/ant/helper/ProjectHelper2.java src/main/org/apache/tools/ant/launch/Locator.java src/tests/antunit/taskdefs/taskdef-test.xml

Posted by Stefan Bodewig <bo...@apache.org>.
On 2010-09-27, Jesse Glick wrote:

> On 09/27/2010 10:49 AM, Stefan Bodewig wrote:
>>   (2) The new tests create JARs that will be loaded by a classloader -
>>     which means Ant cannot delete them because they remain locked until
>>     the JVM has exited.

> Can't this at least use something inside ${build.dir}, rather than
> ${java.io.tmpdir}?

Done.

> (And AntClassLoader should probably implement Closeable to match
> URLClassLoader

AntClassLoader5 could and in fact now does.

Stefan

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


Re: svn commit: r1001756 - in /ant/core/trunk: WHATSNEW src/main/org/apache/tools/ant/helper/ProjectHelper2.java src/main/org/apache/tools/ant/launch/Locator.java src/tests/antunit/taskdefs/taskdef-test.xml

Posted by Jesse Glick <je...@oracle.com>.
On 09/27/2010 10:49 AM, Stefan Bodewig wrote:
>   (2) The new tests create JARs that will be loaded by a classloader -
>     which means Ant cannot delete them because they remain locked until
>     the JVM has exited.

Can't this at least use something inside ${build.dir}, rather than ${java.io.tmpdir}?

Maybe <classloader reset="true" ...> could be used, if the to-do comment in it to close the old loader were implemented? Or a project when finishing a build could close 
all of its outstanding class loader references automatically?

(And AntClassLoader should probably implement Closeable to match URLClassLoader and "automatic resource management" <https://docs.google.com/View?id=ddv8ts74_3fs7483dp> 
in JDK 7!)


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