diff --git a/pom.xml b/pom.xml index f8844ec7c..73015a137 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.xceptance xlt - 6.1.0 + 6.1.1 jar XLT @@ -257,7 +257,7 @@ dnsjava dnsjava - 2.1.9 + 3.5.0 com.caucho diff --git a/src/main/java/com/xceptance/xlt/api/webdriver/XltChromeDriver.java b/src/main/java/com/xceptance/xlt/api/webdriver/XltChromeDriver.java index 5f0435a1b..0aea8b3f3 100644 --- a/src/main/java/com/xceptance/xlt/api/webdriver/XltChromeDriver.java +++ b/src/main/java/com/xceptance/xlt/api/webdriver/XltChromeDriver.java @@ -17,6 +17,7 @@ import java.io.File; import java.net.URL; +import java.util.Map; import org.apache.commons.io.FileUtils; import org.apache.commons.lang3.ObjectUtils; @@ -362,7 +363,7 @@ private static ChromeDriverService modifyService(ChromeDriverService service, fi // HACK: we can access the service's environment settings via reflection only // read the environment settings - final ImmutableMap environment = ReflectionUtils.readField(ChromeDriverService.class, service, + final Map environment = ReflectionUtils.readField(ChromeDriverService.class, service, FIELD_NAME_ENVIRONMENT); // create the new environment settings including the DISPLAY variable diff --git a/src/main/java/com/xceptance/xlt/api/webdriver/XltFirefoxDriver.java b/src/main/java/com/xceptance/xlt/api/webdriver/XltFirefoxDriver.java index 4f1ea17af..41197b156 100644 --- a/src/main/java/com/xceptance/xlt/api/webdriver/XltFirefoxDriver.java +++ b/src/main/java/com/xceptance/xlt/api/webdriver/XltFirefoxDriver.java @@ -17,6 +17,7 @@ import java.io.File; import java.net.URL; +import java.util.Map; import org.apache.commons.io.FileUtils; import org.apache.commons.lang3.ObjectUtils; @@ -416,7 +417,7 @@ private static DriverService modifyService(final DriverService service, final bo */ // read the environment settings - final ImmutableMap environment = ReflectionUtils.readField(DriverService.class, service, + final Map environment = ReflectionUtils.readField(DriverService.class, service, FIELD_NAME_ENVIRONMENT); // create the new environment settings including the DISPLAY variable diff --git a/src/main/java/com/xceptance/xlt/engine/dns/DnsJavaHostNameResolver.java b/src/main/java/com/xceptance/xlt/engine/dns/DnsJavaHostNameResolver.java index 491ce33f4..79df3702f 100644 --- a/src/main/java/com/xceptance/xlt/engine/dns/DnsJavaHostNameResolver.java +++ b/src/main/java/com/xceptance/xlt/engine/dns/DnsJavaHostNameResolver.java @@ -17,8 +17,8 @@ import java.net.InetAddress; import java.net.UnknownHostException; +import java.time.Duration; -import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.StringUtils; import org.xbill.DNS.AAAARecord; import org.xbill.DNS.ARecord; @@ -69,7 +69,7 @@ class DnsJavaHostNameResolver implements HostNameResolver final String[] serverAddresses = StringUtils.split(dnsServers, "\t ,;"); resolver = (serverAddresses.length == 0) ? new ExtendedResolver() : new ExtendedResolver(serverAddresses); - resolver.setTimeout(timeoutSeconds); + resolver.setTimeout(Duration.ofSeconds(timeoutSeconds)); if (ednsVersion >= 0) { @@ -132,7 +132,7 @@ private Record[] lookupRecordsByHostName(final String name) throws UnknownHostEx final Record[] a = createNewLookup(name, Type.A).run(); final Record[] aaaa = createNewLookup(name, Type.AAAA).run(); - final Record[] merged = ArrayUtils.addAll(a, aaaa); + final Record[] merged = concatRecordArrays(a, aaaa); if (merged == null) { throw new UnknownHostException("Unknown host: " + name); @@ -146,6 +146,43 @@ private Record[] lookupRecordsByHostName(final String name) throws UnknownHostEx } } + /** + * Concatenates the given {@link Record} arrays, handling null arrays sensibly. + * + * @param a + * the A records (may be null) + * @param aaaa + * the AAAA records (may be null) + * @return null if both input arrays were null, a result {@link Record} array otherwise + */ + private Record[] concatRecordArrays(final Record[] a, final Record[] aaaa) + { + /* + * Replaces "ArrayUtils.addAll(a, aaaa)" which cannot handle arrays of different sub-types, i.e. ARecord[] and + * AAAARecord[]. + */ + + final Record[] combined; + + if (a == null) + { + combined = aaaa; + } + else if (aaaa == null) + { + combined = a; + } + else + { + combined = new Record[a.length + aaaa.length]; + + System.arraycopy(a, 0, combined, 0, a.length); + System.arraycopy(aaaa, 0, combined, a.length, aaaa.length); + } + + return combined; + } + /** * Creates a new {@link Lookup} instance for the given host name and query type and customizes it a bit. */