ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 8031] - [PATCH] Suggest ProjectHelperImpl use File.toURI().toURL().toExternalForm()
Date Thu, 23 Oct 2003 19:44:01 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=8031>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=8031

[PATCH] Suggest ProjectHelperImpl use File.toURI().toURL().toExternalForm()

jglick@netbeans.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|Suggest ProjectHelperImpl   |[PATCH] Suggest
                   |use                         |ProjectHelperImpl use
                   |File.toURI().toURL().toExter|File.toURI().toURL().toExter
                   |nalForm()                   |nalForm()



------- Additional Comments From jglick@netbeans.org  2003-10-23 19:44 -------
Well I have a patch now, which uses URI on JDK 1.4 and otherwise uses the old
logic. All unit tests seem to pass for me on Linux, JDK 1.4.2, offline=true;
otherwise YMMV. Not sure how safe this is for 1.6, might be more appropriate for
1.7 - up to judgement of the committers.

Of especial interest:

1. A couple of unit tests were IMHO incorrect and I changed them enough to pass
(hopefully still asserting what should be true). Please inspect carefully. Note
that Java does *not* specify what precise form file: URIs should take on various
platforms, only some aspects of their behavior, so the unit tests have to live
on the edge a bit.

2. I don't know where the convention of using URLs such as "file:./foo.xml" or
"file:foo.xml" (rather than simply "foo.xml") for entity includes came from, but
it certainly looks like it violates common sense as well as the URI
specification. (Relative URIs have no protocol and are resolved from a base URI
which does.) JDK 1.4's new File(URI) rejects such URIs (correctly IMHO, though I
could imagine them being resolved relative to the JVM's current working
directory, however useless that might be). Ant's faq.xml used to recommend this
"file:./etc" style for whatever reason. The patch corrects the FAQ. However, for
compatibility with existing (IMHO erroneous) build scripts, file: URIs which do
not have an absolute path beginning with '/' (and are thus illegal) are just
passed through to the old parsing mechanism even on JDK 1.4. IncludeTest thus
continues to pass using both syntaxes.

2a. While fromURI thus accepts relative paths for compatibility, toURI attempts
to always produce a URI encoding an absolute path for safety.

3. Fixed up some places in the codebase that were failing to use the FileUtils
methods to create or interpret file: URLs and were thus in danger of behaving
incorrectly for some pathnames.

4. Removed obsolete FILE_PROTOCOL_PREFIX from the XSLTLiaison interface. It was
not being used anywhere, and was not really correct anyway. (F_P_P +
file.getAbsolutePath() is not a safe way to make URIs, and the extra "//" at the
end of the prefix is gratuitous since there will never be an authority for a
file URI.)

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


Mime
View raw message