Browse Source

more diagnostics, corrected method name, but not working. Bug#35006

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@278318 13f79535-47bb-0310-9956-ffa450edef68
master
Steve Loughran 20 years ago
parent
commit
b586ae4ed7
1 changed files with 3 additions and 1 deletions
  1. +3
    -1
      src/main/org/apache/tools/ant/taskdefs/condition/IsReachable.java

+ 3
- 1
src/main/org/apache/tools/ant/taskdefs/condition/IsReachable.java View File

@@ -81,6 +81,7 @@ public class IsReachable extends ProjectComponent implements Condition {
public static final String MSG_NO_REACHABLE_TEST = "cannot do a proper reachability test on this Java version"; public static final String MSG_NO_REACHABLE_TEST = "cannot do a proper reachability test on this Java version";
public static final String ERROR_BAD_URL = "Bad URL "; public static final String ERROR_BAD_URL = "Bad URL ";
public static final String ERROR_NO_HOST_IN_URL = "No hostname in URL "; public static final String ERROR_NO_HOST_IN_URL = "No hostname in URL ";
private static final String METHOD_NAME = "isReachable";


/** /**
* The host to ping. * The host to ping.
@@ -168,7 +169,7 @@ public class IsReachable extends ProjectComponent implements Condition {
//Java1.5: reachable = address.isReachable(timeout * 1000); //Java1.5: reachable = address.isReachable(timeout * 1000);
Method reachableMethod = null; Method reachableMethod = null;
try { try {
reachableMethod = InetAddress.class.getMethod("reachable",
reachableMethod = InetAddress.class.getMethod(METHOD_NAME,
parameterTypes); parameterTypes);
Object[] params = new Object[1]; Object[] params = new Object[1];
params[0] = new Integer(timeout * 1000); params[0] = new Integer(timeout * 1000);
@@ -187,6 +188,7 @@ public class IsReachable extends ProjectComponent implements Condition {
} }
} catch (NoSuchMethodException e) { } catch (NoSuchMethodException e) {
//java1.4 or earlier //java1.4 or earlier
log("Not found: InetAddress."+METHOD_NAME,Project.MSG_VERBOSE);
log(MSG_NO_REACHABLE_TEST); log(MSG_NO_REACHABLE_TEST);
reachable = true; reachable = true;




Loading…
Cancel
Save