in aws-xray-recorder-sdk-core/src/main/java/com/amazonaws/xray/config/DaemonConfiguration.java [158:196]
private void processAddress(@Nullable String addr) {
if (StringValidator.isNullOrBlank(addr)) {
throw new IllegalArgumentException("Cannot set null daemon address. Value must be of form \"ip_address:port\".");
}
String[] splitStr = addr.split("\\s+");
if (splitStr.length > 2) {
throw new IllegalArgumentException("Invalid value for agent address: " + addr
+ ". Value must be of form \"ip_address:port\" or \"tcp:ip_address:port udp:ip_address:port\".");
}
if (splitStr.length == 1) {
setTCPAddress(addr);
setUDPAddress(addr);
} else if (splitStr.length == 2) {
String[] part1 = splitStr[0].split(":");
String[] part2 = splitStr[1].split(":");
if (part1.length != 3 && part2.length != 3) {
throw new IllegalArgumentException("Invalid value for agent address: " + splitStr[0] + " and " + splitStr[1]
+ ". Value must be of form \"tcp:ip_address:port udp:ip_address:port\".");
}
Map<String, String[]> mapping = new HashMap<>();
mapping.put(part1[0], part1);
mapping.put(part2[0], part2);
String[] tcpInfo = mapping.get("tcp");
String[] udpInfo = mapping.get("udp");
if (tcpInfo == null || udpInfo == null) {
throw new IllegalArgumentException("Invalid value for agent address: " + splitStr[0] + " and " + splitStr[1]
+ ". Value must be of form \"tcp:ip_address:port udp:ip_address:port\".");
}
setTCPAddress(tcpInfo[1] + ":" + tcpInfo[2]);
setUDPAddress(udpInfo[1] + ":" + udpInfo[2]);
} else {
throw new IllegalArgumentException("Invalid value for agent address: " + addr
+ ". Value must be of form \"ip_address:port\" or \"tcp:ip_address:port udp:ip_address:port\".");
}
}