ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Li <da...@digitalsesame.com>
Subject Re: [PATCH to Bug 625] Incorrect handling of External Entity...
Date Sat, 17 Feb 2001 07:59:59 GMT
Conor,

  Thanks for the response. 

I attached another patch that solves both of our problems. Basically,
the patch create a InputSource from a FileInputStream so your problem
with filename with # being used as URI fregment won't exist. The
systemId set on the InputSource so the parser can read the System Entity
correctly.

I believe this compilant toh the External Entity (4.2.2) in the XML
spec.

http://www.w3.org/TR/REC-xml#sec-entity-decl

Right the sentence you quoted below refering to the System Entity.

"meant to be dereferenced to obtain input for the XML processor to
construct the entity's replacement text.] ... relative URIs are relative
to the location of the resource within which the entity declaration
occurs."

According to the above, if a system entity build.inc is define in
file:/foo/bar/build.xml. It should be dereference to
file:/foo/bar/build.inc. I believe patch implements this semantics.

Regarding to the build.inc in the Log4J distribution. I think the
development team has forgotten to include it in the tar/zip
distribution. I got it from the CVS.

David Li
DigitalSesame

Conor MacNeill wrote:
> 
> David,
> 
> Sorry, I saw your earlier post on this subject but didn't get around to
> addressing it. I am not an expert on XML entity declarations but I did some
> background research on this.
> 
> Firstly, let me point you to this patch, applied about a month ago which is
> the reverse of the first part of your patch
> http://jakarta.apache.org/cvsweb/index.cgi/jakarta-ant/src/main/org/apache/
> tools/ant/ProjectHelper.java.diff?r1=1.44&r2=1.45&diff_format=h
> 
> Now I believe that patch was to prevent a # in a directory name being
> interpreted as a URL fragment separator. This used to fail and I can only
> assume that JAXP is converting the File object in this call
> 
> public void parse(File file, HandlerBase base)
> 
> into a file: URL and then invoking
> 
> public void parse(String uri, HandlerBase base)
> 
> Maybe, that is not a good approach.
> 
> According to the XML spec, the SystemLiteral is a URI as defined in
> RFC2396/RFC2732. I am not sure how the XML parser will interpret the
> build.inc in
>     <!ENTITY build.inc SYSTEM "build.inc">
> 
> as a URI.
> 
> The second part of your patch is in an if block
>             if (systemId.startsWith("file:")) {
> 
> so it is unlikely that "build.inc" will trigger the changed code. I would
> be inclined to change your "build.inc" to "file:build.inc" as presented in
> the FAQ. Otherwise, we would have to exclude directories which include the
> # character from being used with Ant. To quote the original bug report
> 
> "This bug is particularly nasty for us since we use the Continuus
> configuration management system which likes to place projects under a
> directory named projectName#userName. This bug renders ANT unusable in our
> environment. "
> 
> Also, to test this I checked out log4j and did not find the exact
> construction you mention. I did find a lot of references to build.inc but
> no build.inc itself.
> 
> I'd be interested in comments on this. My inclination is to say this is not
> a bug.
> 
> Conor
>
Mime
View raw message