You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by hi...@apache.org on 2017/05/21 17:35:21 UTC

[1/2] ant-ivy git commit: Use the specified timeout for connections in BasicURLHandler

Repository: ant-ivy
Updated Branches:
  refs/heads/master 7fc5eee60 -> 7a4bad056


Use the specified timeout for connections in BasicURLHandler


Project: http://git-wip-us.apache.org/repos/asf/ant-ivy/repo
Commit: http://git-wip-us.apache.org/repos/asf/ant-ivy/commit/c1ad21bf
Tree: http://git-wip-us.apache.org/repos/asf/ant-ivy/tree/c1ad21bf
Diff: http://git-wip-us.apache.org/repos/asf/ant-ivy/diff/c1ad21bf

Branch: refs/heads/master
Commit: c1ad21bf966d01dc5cceca82f102c0f7843d5617
Parents: 658a8d8
Author: Jaikiran Pai <ja...@gmail.com>
Authored: Sun May 21 10:59:58 2017 +0530
Committer: Jaikiran Pai <ja...@gmail.com>
Committed: Sun May 21 10:59:58 2017 +0530

----------------------------------------------------------------------
 src/java/org/apache/ivy/util/url/BasicURLHandler.java    |  1 +
 .../org/apache/ivy/util/url/BasicURLHandlerTest.java     | 11 ++++++-----
 2 files changed, 7 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/c1ad21bf/src/java/org/apache/ivy/util/url/BasicURLHandler.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/util/url/BasicURLHandler.java b/src/java/org/apache/ivy/util/url/BasicURLHandler.java
index 72641ef..0ad23c5 100644
--- a/src/java/org/apache/ivy/util/url/BasicURLHandler.java
+++ b/src/java/org/apache/ivy/util/url/BasicURLHandler.java
@@ -64,6 +64,7 @@ public class BasicURLHandler extends AbstractURLHandler {
         try {
             url = normalizeToURL(url);
             con = url.openConnection();
+            con.setConnectTimeout(timeout);
             con.setRequestProperty("User-Agent", getUserAgent());
             if (con instanceof HttpURLConnection) {
                 HttpURLConnection httpCon = (HttpURLConnection) con;

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/c1ad21bf/test/java/org/apache/ivy/util/url/BasicURLHandlerTest.java
----------------------------------------------------------------------
diff --git a/test/java/org/apache/ivy/util/url/BasicURLHandlerTest.java b/test/java/org/apache/ivy/util/url/BasicURLHandlerTest.java
index 8ce9955..c6da184 100644
--- a/test/java/org/apache/ivy/util/url/BasicURLHandlerTest.java
+++ b/test/java/org/apache/ivy/util/url/BasicURLHandlerTest.java
@@ -45,15 +45,16 @@ public class BasicURLHandlerTest extends TestCase {
     }
 
     public void testIsReachable() throws Exception {
-        assertTrue(handler.isReachable(new URL("http://www.google.fr/")));
-        assertFalse(handler.isReachable(new URL("http://www.google.fr/unknownpage.html")));
+        final int connectionTimeoutInMillis = 15000; // 15 seconds
+        assertTrue(handler.isReachable(new URL("http://www.google.fr/"), connectionTimeoutInMillis));
+        assertFalse(handler.isReachable(new URL("http://www.google.fr/unknownpage.html"), connectionTimeoutInMillis));
 
-        assertTrue(handler.isReachable(new File("build.xml").toURI().toURL()));
-        assertFalse(handler.isReachable(new File("unknownfile.xml").toURI().toURL()));
+        assertTrue(handler.isReachable(new File("build.xml").toURI().toURL(), connectionTimeoutInMillis));
+        assertFalse(handler.isReachable(new File("unknownfile.xml").toURI().toURL(), connectionTimeoutInMillis));
 
         // to test ftp we should know of an anonymous ftp site... !
         // assertTrue(handler.isReachable(new URL("ftp://ftp.mozilla.org/pub/dir.sizes")));
-        assertFalse(handler.isReachable(new URL("ftp://ftp.mozilla.org/unknown.file")));
+        assertFalse(handler.isReachable(new URL("ftp://ftp.mozilla.org/unknown.file"), connectionTimeoutInMillis));
     }
 
     public void testContentEncoding() throws Exception {


[2/2] ant-ivy git commit: This closes #23

Posted by hi...@apache.org.
This closes #23


Project: http://git-wip-us.apache.org/repos/asf/ant-ivy/repo
Commit: http://git-wip-us.apache.org/repos/asf/ant-ivy/commit/7a4bad05
Tree: http://git-wip-us.apache.org/repos/asf/ant-ivy/tree/7a4bad05
Diff: http://git-wip-us.apache.org/repos/asf/ant-ivy/diff/7a4bad05

Branch: refs/heads/master
Commit: 7a4bad05616fef7500d4d97a395553b290d14435
Parents: 7fc5eee c1ad21b
Author: Nicolas Lalevée <ni...@hibnet.org>
Authored: Sun May 21 19:34:52 2017 +0200
Committer: Nicolas Lalevée <ni...@hibnet.org>
Committed: Sun May 21 19:34:52 2017 +0200

----------------------------------------------------------------------
 src/java/org/apache/ivy/util/url/BasicURLHandler.java    |  1 +
 .../org/apache/ivy/util/url/BasicURLHandlerTest.java     | 11 ++++++-----
 2 files changed, 7 insertions(+), 5 deletions(-)
----------------------------------------------------------------------