| Chunk |
|---|
| Conflicting content |
|---|
import java.net.InetAddress; import java.net.Inet4Address; <<<<<<< HEAD ======= import java.net.InterfaceAddress; import java.net.NetworkInterface; import java.net.SocketException; >>>>>>> ae4fe1f7ab670409b5277967dea67ce8e81c9c41 import java.net.UnknownHostException; import java.util.HashMap; |
| Solution content |
|---|
import java.net.InetAddress; import java.net.Inet4Address; import java.net.UnknownHostException; import java.util.HashMap; |
| File |
|---|
| DataConnection.java |
| Developer's decision |
|---|
| Version 1 |
| Kind of conflict |
|---|
| Import |
| Chunk |
|---|
| Conflicting content |
|---|
LinkProperties linkProperties = new LinkProperties();
if (response.status == FailCause.NONE.getErrorCode()) {
try {
<<<<<<< HEAD
cid = response.cid;
linkProperties.setInterfaceName(response.ifname);
for (String addr : response.addresses) {
LinkAddress la;
if (!InetAddress.isNumeric(addr)) {
EventLogTags.writeBadIpAddress(addr);
throw new UnknownHostException("Non-numeric ip addr=" + addr);
}
InetAddress ia = InetAddress.getByName(addr);
if (ia instanceof Inet4Address) {
la = new LinkAddress(ia, 32);
} else {
la = new LinkAddress(ia, 128);
}
linkProperties.addLinkAddress(la);
}
if (response.dnses.length != 0) {
for (String addr : response.dnses) {
if (!InetAddress.isNumeric(addr)) {
EventLogTags.writePdpBadDnsAddress("dns=" + addr);
throw new UnknownHostException("Non-numeric dns addr=" + addr);
}
InetAddress ia = InetAddress.getByName(addr);
linkProperties.addDns(ia);
}
result = SetupResult.SUCCESS;
} else {
String prefix = "net." + response.ifname + ".";
=======
String prefix = "net." + interfaceName + ".";
NetworkInterface networkInterface = NetworkInterface.getByName(interfaceName);
linkProperties.setInterfaceName(interfaceName);
if (response.length >= 5) {
log("response.length >=5 using response for ip='" + response[2] +
"' dns='" + response[3] + "' gateway='" + response[4] + "'");
String [] addresses = response[2].split(" ");
String [] dnses = response[3].split(" ");
String gateway = response[4];
for (String addr : addresses) {
LinkAddress la;
if (!InetAddress.isNumeric(addr)) {
throw new RuntimeException(
"Vendor ril bug: Non-numeric ip addr=" + addr);
}
InetAddress ia = InetAddress.getByName(addr);
if (ia instanceof Inet4Address) {
la = new LinkAddress(ia, 32);
} else {
la = new LinkAddress(ia, 128);
}
linkProperties.addLinkAddress(la);
}
if (dnses.length != 0) {
for (String addr : dnses) {
if (!InetAddress.isNumeric(addr)) {
throw new RuntimeException(
"Vendor ril bug: Non-numeric dns addr=" + addr);
}
InetAddress ia = InetAddress.getByName(addr);
linkProperties.addDns(ia);
}
result = SetupResult.SUCCESS;
} else {
result = SetupResult.ERR_BadDns;
}
if (!InetAddress.isNumeric(gateway)) {
throw new RuntimeException(
"Vendor ril bug: Non-numeric gateway addr=" + gateway);
}
linkProperties.setGateway(InetAddress.getByName(gateway));
} else {
log("response.length < 5 using properties for dns and gateway");
for (InterfaceAddress addr : networkInterface.getInterfaceAddresses()) {
linkProperties.addLinkAddress(new LinkAddress(addr));
}
String gatewayAddress = SystemProperties.get(prefix + "gw");
linkProperties.setGateway(InetAddress.getByName(gatewayAddress));
>>>>>>> ae4fe1f7ab670409b5277967dea67ce8e81c9c41
String dnsServers[] = new String[2];
dnsServers[0] = SystemProperties.get(prefix + "dns1"); |
| Solution content |
|---|
LinkProperties linkProperties = new LinkProperties();
if (response.status == FailCause.NONE.getErrorCode()) {
try {
cid = response.cid;
linkProperties.setInterfaceName(response.ifname);
for (String addr : response.addresses) {
LinkAddress la;
if (!InetAddress.isNumeric(addr)) {
EventLogTags.writeBadIpAddress(addr);
throw new UnknownHostException("Non-numeric ip addr=" + addr);
}
InetAddress ia = InetAddress.getByName(addr);
if (ia instanceof Inet4Address) {
la = new LinkAddress(ia, 32);
} else {
la = new LinkAddress(ia, 128);
}
linkProperties.addLinkAddress(la);
}
if (response.dnses.length != 0) {
for (String addr : response.dnses) {
if (!InetAddress.isNumeric(addr)) {
EventLogTags.writePdpBadDnsAddress("dns=" + addr);
throw new UnknownHostException("Non-numeric dns addr=" + addr);
}
InetAddress ia = InetAddress.getByName(addr);
linkProperties.addDns(ia);
}
result = SetupResult.SUCCESS;
} else {
String prefix = "net." + response.ifname + ".";
String dnsServers[] = new String[2];
dnsServers[0] = SystemProperties.get(prefix + "dns1"); |
| File |
|---|
| DataConnection.java |
| Developer's decision |
|---|
| Version 1 |
| Kind of conflict |
|---|
| Array access |
| Attribute |
| For statement |
| If statement |
| Method invocation |
| Variable |
| Chunk |
|---|
| Conflicting content |
|---|
}
dnsServers[0] = SystemProperties.get(prefix + "dns1");
dnsServers[1] = SystemProperties.get(prefix + "dns2");
if (isDnsOk(dnsServers)) {
<<<<<<< HEAD
for (String dnsAddr : dnsServers) {
if (!InetAddress.isNumeric(dnsAddr)) {
EventLogTags.writePdpBadDnsAddress("dnsAddr=" + dnsAddr);
throw new UnknownHostException("Non-numeric dns addr="
+ dnsAddr);
InetAddress ia = InetAddress.getByName(dnsAddr);
linkProperties.addDns(ia);
}
result = SetupResult.SUCCESS;
} else {
StringBuilder sb = new StringBuilder();
for (String dnsAddr : dnsServers) {
sb.append(dnsAddr);
sb.append(" ");
}
EventLogTags.writePdpBadDnsAddress("Unacceptable dns addresses=" + sb);
throw new UnknownHostException("Unacceptable dns addresses=" + sb);
=======
linkProperties.addDns(InetAddress.getByName(dnsServers[0]));
linkProperties.addDns(InetAddress.getByName(dnsServers[1]));
} else {
result = SetupResult.ERR_BadDns;
>>>>>>> ae4fe1f7ab670409b5277967dea67ce8e81c9c41
}
}
} catch (UnknownHostException e) { |
| Solution content |
|---|
dnsServers[0] = SystemProperties.get(prefix + "dns1");
dnsServers[1] = SystemProperties.get(prefix + "dns2");
if (isDnsOk(dnsServers)) {
for (String dnsAddr : dnsServers) {
if (!InetAddress.isNumeric(dnsAddr)) {
EventLogTags.writePdpBadDnsAddress("dnsAddr=" + dnsAddr);
throw new UnknownHostException("Non-numeric dns addr="
+ dnsAddr);
}
InetAddress ia = InetAddress.getByName(dnsAddr);
linkProperties.addDns(ia);
}
result = SetupResult.SUCCESS;
} else {
StringBuilder sb = new StringBuilder();
for (String dnsAddr : dnsServers) {
sb.append(dnsAddr);
sb.append(" ");
}
EventLogTags.writePdpBadDnsAddress("Unacceptable dns addresses=" + sb);
throw new UnknownHostException("Unacceptable dns addresses=" + sb);
}
}
} catch (UnknownHostException e) { |
| File |
|---|
| DataConnection.java |
| Developer's decision |
|---|
| Version 1 |
| Kind of conflict |
|---|
| For statement |
| Method invocation |
| Throw statement |
| Variable |