Skip to content

Commit

Permalink
minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
seran committed Oct 4, 2023
1 parent 1624ff9 commit ca42ad6
Showing 1 changed file with 23 additions and 20 deletions.
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
package org.evomaster.client.java.instrumentation.coverage.methodreplacement.classes;

import org.evomaster.client.java.instrumentation.ExternalServiceInfo;
import org.evomaster.client.java.instrumentation.HostnameInfo;
import org.evomaster.client.java.instrumentation.coverage.methodreplacement.ExternalServiceInfoUtils;
import org.evomaster.client.java.instrumentation.coverage.methodreplacement.MethodReplacementClass;
import org.evomaster.client.java.instrumentation.coverage.methodreplacement.Replacement;
import org.evomaster.client.java.instrumentation.coverage.methodreplacement.UsageFilter;
import org.evomaster.client.java.instrumentation.shared.ExternalServiceSharedUtils;
import org.evomaster.client.java.instrumentation.shared.ReplacementCategory;
import org.evomaster.client.java.instrumentation.shared.ReplacementType;
import org.evomaster.client.java.instrumentation.staticstate.ExecutionTracer;
import sun.jvm.hotspot.HSDB;

import java.net.*;

Expand Down Expand Up @@ -41,17 +44,17 @@ public static InetAddress getByName(String host) throws UnknownHostException {
String ip = ExecutionTracer.getLocalAddress(host);
return InetAddress.getByName(ip);
}
return InetAddress.getByName(host);
InetAddress inetAddress = InetAddress.getByName(host);
ExecutionTracer.addHostnameInfo(new HostnameInfo(host, true));
return inetAddress;
} catch (UnknownHostException e) {
// ExternalServiceInfo remoteHostInfo = new ExternalServiceInfo(
// ExternalServiceSharedUtils.DEFAULT_SOCKET_CONNECT_PROTOCOL,
// host,
// -1,
// false
// );
HostnameInfo hostnameInfo = new HostnameInfo(host, false);
// ExecutionTracer.addExternalServiceHost(remoteHostInfo);
ExecutionTracer.addHostnameInfo(hostnameInfo);
ExternalServiceInfo remoteHostInfo = new ExternalServiceInfo(
ExternalServiceSharedUtils.DEFAULT_SOCKET_CONNECT_PROTOCOL,
host,
-1
);
ExecutionTracer.addExternalServiceHost(remoteHostInfo);
ExecutionTracer.addHostnameInfo(new HostnameInfo(host, false));
throw e;
}
}
Expand All @@ -71,17 +74,17 @@ public static InetAddress[] getAllByName(String host) throws UnknownHostExceptio
String ip = ExecutionTracer.getLocalAddress(host);
return new InetAddress[]{InetAddress.getByName(ip)};
}
return InetAddress.getAllByName(host);
InetAddress[] inetAddresses = InetAddress.getAllByName(host);
ExecutionTracer.addHostnameInfo(new HostnameInfo(host, true));
return inetAddresses;
} catch (UnknownHostException e) {
// ExternalServiceInfo remoteHostInfo = new ExternalServiceInfo(
// ExternalServiceSharedUtils.DEFAULT_SOCKET_CONNECT_PROTOCOL,
// host,
// -1,
// false
// );
HostnameInfo hostnameInfo = new HostnameInfo(host, false);
// ExecutionTracer.addExternalServiceHost(remoteHostInfo);
ExecutionTracer.addHostnameInfo(hostnameInfo);
ExternalServiceInfo remoteHostInfo = new ExternalServiceInfo(
ExternalServiceSharedUtils.DEFAULT_SOCKET_CONNECT_PROTOCOL,
host,
-1
);
ExecutionTracer.addHostnameInfo(new HostnameInfo(host, false));
ExecutionTracer.addExternalServiceHost(remoteHostInfo);
throw e;
}
}
Expand Down

0 comments on commit ca42ad6

Please sign in to comment.