Bug 20819 - [ExternalTools] Ant ui does not handle ENTITY entries in all cases
Summary: [ExternalTools] Ant ui does not handle ENTITY entries in all cases
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Ant (show other bugs)
Version: 2.0   Edit
Hardware: PC Windows 2000
: P2 normal (vote)
Target Milestone: 2.0.1   Edit
Assignee: Ryan Cooper CLA
QA Contact:
URL:
Whiteboard:
Keywords: readme, ui
: 21798 (view as bug list)
Depends on: 21595
Blocks: 18692 20635
  Show dependency tree
 
Reported: 2002-06-21 13:55 EDT by Simon Arsenault CLA
Modified: 2002-09-18 13:58 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Simon Arsenault CLA 2002-06-21 13:55:28 EDT
The Ant ui does it own parsing of the build file to get the list of targets. It 
cannot use the ProjectHelper class from Ant because the Ant version shipped 
with Eclipse (as of release 2.0) is version 1.4, and that version does not 
handle 1.5 Ant build files.

When parsing the file, we tell the parser what the base directory is and also 
provide an EntityResolver to handle SYSTEM values with start with the 
protocol "file:" All other values are left to the XML parser to handle.

Unfortunately, not all XML parser will handle relative paths such 
as "../../common.xml" properly. It seems to depend on the JRE being used and 
which parser is registered to be used. The org.apache.crimson parser is one 
that will not handle relative paths properly (it seems to want a valid URI 
only).

We need to update our Entity Resolver to handle this case and not leave it to 
the default parser. In other words, it should handle values that start 
with "file:" or values that do not have a protocol in front of it 
(like "../../common.xml"). It is very important that we do not handle values 
with other protocol (like "http:", etc).

The AntRunner will also parse the build file when asked to run it. However, it 
uses the SAXParser always and has it's own Entity Resolver, so it does not have 
this problem - build files always seen to run correctly.

For background reference, please see the following problem reports (bug 18692 
and bug 20635)
Comment 1 Simon Arsenault CLA 2002-06-21 14:00:17 EDT
For release 2.0, this limitation will be documented in the readme. The 
workaround is for people to add the "file:" protocol to their paths. For 
example, instead of
   <!ENTITY custom SYSTEM "../../custom.xml">
use
   <!ENTITY custom SYSTEM "file:/../../custom.xml">
Comment 2 Rodrigo Peretti CLA 2002-06-27 11:08:45 EDT
Note that <!ENTITY custom SYSTEM "file:/../../custom.xml"> does not work on 
Linux. It has to be <!ENTITY custom SYSTEM "file:../../custom.xml"> .
Comment 3 Simon Arsenault CLA 2002-07-22 13:57:24 EDT
The ant external tool support should no longer try to parse the XML Ant build 
file to get the list of targets. Instead, it should call AntRunner.getTargets() 
in ant.core plugin. (We can drop all the code in AntUtil dealing with reading 
in targets, including the entity resolver code).

To be fixed in 2.0.1
Comment 4 Simon Arsenault CLA 2002-07-25 13:32:37 EDT
*** Bug 21798 has been marked as a duplicate of this bug. ***
Comment 5 Simon Arsenault CLA 2002-08-08 14:01:17 EDT
Fixed in the 2.0.1 code stream. Opened bug 22273 to port fix to 2.1 code stream.