https://bz.apache.org/bugzilla/show_bug.cgi?id=59104
Bug ID: 59104
Summary: <makeurl> generates the wrong URL on Windows
Product: Ant
Version: 1.9.4
Hardware: PC
Status: NEW
Severity: normal
Priority: P2
Component: Core tasks
Assignee: [email protected]
Reporter: [email protected]
In our build, we are using <makeurl> to generate the URL for
log4j.configuration:
<makeurl file="${project.dir}/src/config/log4j.properties"
property="log4j.configuration.url"/>
On Windows, log4j fails to loadf the configuration, because the URL Ant has
generated is missing one slash.
[exec] log4j:ERROR Could not read configuration file from URL
[file://H:/hudson/sharedspace/trunk/os/windows/src/config/log4j.properties].
java.net.UnknownHostException: H
at
java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:184)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)
at java.net.Socket.connect(Socket.java:589)
at java.net.Socket.connect(Socket.java:538)
at sun.net.ftp.impl.FtpClient.doConnect(FtpClient.java:957)
at sun.net.ftp.impl.FtpClient.tryConnect(FtpClient.java:917)
at sun.net.ftp.impl.FtpClient.connect(FtpClient.java:1012)
at sun.net.ftp.impl.FtpClient.connect(FtpClient.java:998)
at
sun.net.www.protocol.ftp.FtpURLConnection.connect(FtpURLConnection.java:294)
at
sun.net.www.protocol.ftp.FtpURLConnection.getInputStream(FtpURLConnection.java:393)
at
org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurator.java:557)
at
org.apache.log4j.helpers.OptionConverter.selectAndConfigure(OptionConverter.java:526)
at org.apache.log4j.LogManager.<clinit>(LogManager.java:127)
at org.apache.log4j.Logger.getRootLogger(Logger.java:135)
at Main.main(Main.java:59)
So as you can see, it has generated:
file://H:/hudson/sharedspace/trunk/os/windows/src/config/log4j.properties
But it should have been:
file:///H:/hudson/sharedspace/trunk/os/windows/src/config/log4j.properties
Ant isn't doing anything particularly mysterious to convert it:
return new File(path).toURI().toASCIIString();
But back in v1.6.5, there was code that appears to be special casing this exact
thing:
// catch exception if normalize thinks this is not an absolute path
try {
path = normalize(path).getAbsolutePath();
sb.append("//");
// add an extra slash for filesystems with drive-specifiers
if (!path.startsWith(File.separator)) {
sb.append("/");
}
} catch (BuildException e) {
// relative path
}
So I think it's fair to consider this a regression in Ant even if the real bug
is in the JRE.
The code in v1.9.6 is using the same utility method, so I'm assuming it will
cause the same behaviour and haven't tried upgrading to it.
--
You are receiving this mail because:
You are the assignee for the bug.