You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by bu...@apache.org on 2013/06/13 03:50:53 UTC

[Bug 55097] New: Files imported twice if resolved via different resource types

https://issues.apache.org/bugzilla/show_bug.cgi?id=55097

            Bug ID: 55097
           Summary: Files imported twice if resolved via different
                    resource types
           Product: Ant
           Version: 1.9.1
          Hardware: All
                OS: All
            Status: NEW
          Severity: minor
          Priority: P2
         Component: Core tasks
          Assignee: notifications@ant.apache.org
          Reporter: adrian@symphonious.net

Created attachment 30429
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=30429&action=edit
Simple demonstration of problem

If you import the same file via two different resource types (url and
javaresource in my case) it can be resolved to exactly the same URL but still
be imported twice.

Attached is a complete demonstration of this problem.  In brief, if we have a
file imported.xml which fails if it is imported twice, then:

<?xml version="1.0"?>
<project name="multi-import">

  <dirname file="${ant.file}" property="path"/>
  <import>
    <url url="file:${path}/imported.xml"/>
    <javaresource classpath="." name="imported.xml"/>
  </import>
</project>

will fail. This is despite the fact that ant -debug clearly shows the file is
resolved to the same underlying URL:

Importing file file:/home/suttona/bugs/ant-multi-import/imported.xml from
/home/suttona/bugs/ant-multi-import/build.xml
Overriding previous definition of reference to ant.projectHelper
Adding reference: ant.projectHelper
parsing buildfile file:/home/suttona/bugs/ant-multi-import/imported.xml with
URI = file:/home/suttona/bugs/ant-multi-import/imported.xml
...
Importing file imported.xml from /home/suttona/bugs/ant-multi-import/build.xml
ResourceStream for imported.xml loaded from ant loader
Overriding previous definition of reference to ant.projectHelper
Adding reference: ant.projectHelper
Resource imported.xml loaded from ant loader
parsing buildfile file:/home/suttona/bugs/ant-multi-import/imported.xml with
URI = file:/home/suttona/bugs/ant-multi-import/imported.xml


The simplified example is clearly a stupid thing to do, but we ran across this
issue in a much more reasonable use case. For the background see
http://www.symphonious.net/2013/06/12/importing-an-ant-buildfile-multiple-times/

The work around is just to use URLs consistently - they are quite capable of
pointing to files on remote servers local file systems or within zip/jar files
which is all we need.

Issue exists at least as far back as 1.8.4.

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 55097] Files imported twice if resolved via different resource types

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=55097

Stefan Bodewig <bo...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED
   Target Milestone|---                         |1.9.4

--- Comment #1 from Stefan Bodewig <bo...@apache.org> ---
fixed with svn revision 1554400

-- 
You are receiving this mail because:
You are the assignee for the bug.