Author: maartenc
Date: Tue Apr 6 20:35:31 2010
New Revision: 931310
URL: http://svn.apache.org/viewvc?rev=931310&view=rev
Log:
FIX: Ivy cannot connect to URLs with '_' in their hostname
Modified:
ant/ivy/core/trunk/CHANGES.txt
ant/ivy/core/trunk/src/java/org/apache/ivy/util/url/AbstractURLHandler.java
ant/ivy/core/trunk/test/java/org/apache/ivy/util/url/AbstractURLHandlerTest.java
Modified: ant/ivy/core/trunk/CHANGES.txt
URL:
http://svn.apache.org/viewvc/ant/ivy/core/trunk/CHANGES.txt?rev=931310&r1=931309&r2=931310&view=diff
==============================================================================
--- ant/ivy/core/trunk/CHANGES.txt (original)
+++ ant/ivy/core/trunk/CHANGES.txt Tue Apr 6 20:35:31 2010
@@ -119,6 +119,7 @@ for detailed view of each issue, please
- IMPROVEMENT: Trace a message when a property file referenced from the
settings doesn't exixts (IVY-1074)
- IMPROVEMENT: use defaultconf in combination with defaultconfmapping
(IVY-1135) (thanks to Jon Schneider)
+- FIX: Ivy cannot connect to URLs with '_' in their hostname
- FIX: Transitive dependencies resolutions issue when eviction is triggered
(IVY-1178)
- FIX: Can't deal with [VERSION] version pattern from Maven (IVY-1177) (thanks
to Richard Vowles)
- FIX: verbose/debug messages were not logged while running ivy:configure task
Modified:
ant/ivy/core/trunk/src/java/org/apache/ivy/util/url/AbstractURLHandler.java
URL:
http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/util/url/AbstractURLHandler.java?rev=931310&r1=931309&r2=931310&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/util/url/AbstractURLHandler.java
(original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/util/url/AbstractURLHandler.java
Tue Apr 6 20:35:31 2010
@@ -17,7 +17,9 @@
*/
package org.apache.ivy.util.url;
+import java.io.File;
import java.io.IOException;
+import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URI;
@@ -25,6 +27,9 @@ import java.net.URISyntaxException;
import java.net.URL;
import java.util.regex.Pattern;
+import org.apache.ivy.util.CopyProgressListener;
+import org.apache.ivy.util.url.URLHandler.URLInfo;
+
public abstract class AbstractURLHandler implements URLHandler {
private static final Pattern ESCAPE_PATTERN =
Pattern.compile("%25([0-9a-fA-F][0-9a-fA-F])");
@@ -92,8 +97,8 @@ public abstract class AbstractURLHandler
}
try {
- URI uri = new URI(url.getProtocol(), url.getUserInfo(),
url.getHost(),
- url.getPort(), url.getPath(), url.getQuery(),
url.getRef());
+ URI uri = new URI(url.getProtocol(), url.getAuthority(),
+ url.getPath(), url.getQuery(), url.getRef());
// it is possible that the original url was already (partial)
escaped,
// so we must unescape all '%' followed by 2 hexadecimals...
@@ -118,5 +123,4 @@ public abstract class AbstractURLHandler
return new URL(normalizeToString(url));
}
-
}
Modified:
ant/ivy/core/trunk/test/java/org/apache/ivy/util/url/AbstractURLHandlerTest.java
URL:
http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/util/url/AbstractURLHandlerTest.java?rev=931310&r1=931309&r2=931310&view=diff
==============================================================================
---
ant/ivy/core/trunk/test/java/org/apache/ivy/util/url/AbstractURLHandlerTest.java
(original)
+++
ant/ivy/core/trunk/test/java/org/apache/ivy/util/url/AbstractURLHandlerTest.java
Tue Apr 6 20:35:31 2010
@@ -46,6 +46,18 @@ public class AbstractURLHandlerTest exte
assertEquals("http://ant.apache.org/ivy/ivy-1.%2B.xml", normalizedUrl);
}
+ public void testNormalizeToStringWithUnderscoreInHostname() throws
Exception {
+ AbstractURLHandler handler = new TestURLHandler();
+ String normalizedUrl = handler.normalizeToString(new
URL("http://peat_hal.users.sourceforge.net/m2repository"));
+ assertEquals("http://peat_hal.users.sourceforge.net/m2repository",
normalizedUrl);
+ }
+
+ public void testNormalizeToStringWithUnderscoreInHostnameAndSpaceInPath()
throws Exception {
+ AbstractURLHandler handler = new TestURLHandler();
+ String normalizedUrl = handler.normalizeToString(new
URL("http://peat_hal.users.sourceforge.net/m2 repository"));
+ assertEquals("http://peat_hal.users.sourceforge.net/m2%20repository",
normalizedUrl);
+ }
+
private static class TestURLHandler extends AbstractURLHandler {
public void download(URL src, File dest, CopyProgressListener l)
throws IOException {