Program: 2436
Project: 2436
Buggy source:
private NetworkUpdateResult writeIpAndProxyConfigurationsOnChange(WifiConfiguration currentConfig,WifiConfiguration newConfig){
  boolean ipChanged=false;
  boolean proxyChanged=false;
  LinkProperties linkProperties=new LinkProperties();
switch (newConfig.ipAssignment) {
case STATIC:
    Collection<LinkAddress> currentLinkAddresses=currentConfig.linkProperties.getLinkAddresses();
  Collection<LinkAddress> newLinkAddresses=newConfig.linkProperties.getLinkAddresses();
Collection<InetAddress> currentDnses=currentConfig.linkProperties.getDnses();
Collection<InetAddress> newDnses=newConfig.linkProperties.getDnses();
Collection<RouteInfo> currentRoutes=currentConfig.linkProperties.getRoutes();
Collection<RouteInfo> newRoutes=newConfig.linkProperties.getRoutes();
boolean linkAddressesDiffer=(currentLinkAddresses.size() != newLinkAddresses.size()) || !currentLinkAddresses.containsAll(newLinkAddresses);
boolean dnsesDiffer=(currentDnses.size() != newDnses.size()) || !currentDnses.containsAll(newDnses);
boolean routesDiffer=(currentRoutes.size() != newRoutes.size()) || !currentRoutes.containsAll(newRoutes);
if ((currentConfig.ipAssignment != newConfig.ipAssignment) || linkAddressesDiffer || dnsesDiffer|| routesDiffer) {
ipChanged=true;
}
break;
case DHCP:
if (currentConfig.ipAssignment != newConfig.ipAssignment) {
ipChanged=true;
}
break;
case UNASSIGNED:
break;
default :
loge("String_Node_Str");
break;
}
switch (newConfig.proxySettings) {
case STATIC:
ProxyProperties newHttpProxy=newConfig.linkProperties.getHttpProxy();
ProxyProperties currentHttpProxy=currentConfig.linkProperties.getHttpProxy();
if (newHttpProxy != null) {
proxyChanged=!newHttpProxy.equals(currentHttpProxy);
}
 else {
proxyChanged=(currentHttpProxy != null);
}
break;
case NONE:
if (currentConfig.proxySettings != newConfig.proxySettings) {
proxyChanged=true;
}
break;
case UNASSIGNED:
break;
default :
loge("String_Node_Str");
break;
}
if (!ipChanged) {
addIpSettingsFromConfig(linkProperties,currentConfig);
}
 else {
currentConfig.ipAssignment=newConfig.ipAssignment;
addIpSettingsFromConfig(linkProperties,newConfig);
log("String_Node_Str" + currentConfig.SSID + "String_Node_Str"+ linkProperties.toString());
}
if (!proxyChanged) {
linkProperties.setHttpProxy(currentConfig.linkProperties.getHttpProxy());
}
 else {
currentConfig.proxySettings=newConfig.proxySettings;
linkProperties.setHttpProxy(newConfig.linkProperties.getHttpProxy());
log("String_Node_Str" + currentConfig.SSID);
if (linkProperties.getHttpProxy() != null) {
log("String_Node_Str" + linkProperties.getHttpProxy().toString());
}
}
if (ipChanged || proxyChanged) {
currentConfig.linkProperties=linkProperties;
writeIpAndProxyConfigurations();
sendConfiguredNetworksChangedBroadcast(currentConfig,WifiManager.CHANGE_REASON_CONFIG_CHANGE);
}
return new NetworkUpdateResult(ipChanged,proxyChanged);
}

Fixed version (ground truth):
private NetworkUpdateResult writeIpAndProxyConfigurationsOnChange(WifiConfiguration currentConfig,WifiConfiguration newConfig){
  boolean ipChanged=false;
  boolean proxyChanged=false;
  LinkProperties linkProperties=null;
switch (newConfig.ipAssignment) {
case STATIC:
    Collection<LinkAddress> currentLinkAddresses=currentConfig.linkProperties.getLinkAddresses();
  Collection<LinkAddress> newLinkAddresses=newConfig.linkProperties.getLinkAddresses();
Collection<InetAddress> currentDnses=currentConfig.linkProperties.getDnses();
Collection<InetAddress> newDnses=newConfig.linkProperties.getDnses();
Collection<RouteInfo> currentRoutes=currentConfig.linkProperties.getRoutes();
Collection<RouteInfo> newRoutes=newConfig.linkProperties.getRoutes();
boolean linkAddressesDiffer=(currentLinkAddresses.size() != newLinkAddresses.size()) || !currentLinkAddresses.containsAll(newLinkAddresses);
boolean dnsesDiffer=(currentDnses.size() != newDnses.size()) || !currentDnses.containsAll(newDnses);
boolean routesDiffer=(currentRoutes.size() != newRoutes.size()) || !currentRoutes.containsAll(newRoutes);
if ((currentConfig.ipAssignment != newConfig.ipAssignment) || linkAddressesDiffer || dnsesDiffer|| routesDiffer) {
ipChanged=true;
}
break;
case DHCP:
if (currentConfig.ipAssignment != newConfig.ipAssignment) {
ipChanged=true;
}
break;
case UNASSIGNED:
break;
default :
loge("String_Node_Str");
break;
}
switch (newConfig.proxySettings) {
case STATIC:
ProxyProperties newHttpProxy=newConfig.linkProperties.getHttpProxy();
ProxyProperties currentHttpProxy=currentConfig.linkProperties.getHttpProxy();
if (newHttpProxy != null) {
proxyChanged=!newHttpProxy.equals(currentHttpProxy);
}
 else {
proxyChanged=(currentHttpProxy != null);
}
break;
case NONE:
if (currentConfig.proxySettings != newConfig.proxySettings) {
proxyChanged=true;
}
break;
case UNASSIGNED:
break;
default :
loge("String_Node_Str");
break;
}
if (!ipChanged) {
linkProperties=copyIpSettingsFromConfig(currentConfig);
}
 else {
currentConfig.ipAssignment=newConfig.ipAssignment;
linkProperties=copyIpSettingsFromConfig(newConfig);
log("String_Node_Str" + currentConfig.SSID + "String_Node_Str"+ linkProperties.toString());
}
if (!proxyChanged) {
linkProperties.setHttpProxy(currentConfig.linkProperties.getHttpProxy());
}
 else {
currentConfig.proxySettings=newConfig.proxySettings;
linkProperties.setHttpProxy(newConfig.linkProperties.getHttpProxy());
log("String_Node_Str" + currentConfig.SSID);
if (linkProperties.getHttpProxy() != null) {
log("String_Node_Str" + linkProperties.getHttpProxy().toString());
}
}
if (ipChanged || proxyChanged) {
currentConfig.linkProperties=linkProperties;
writeIpAndProxyConfigurations();
sendConfiguredNetworksChangedBroadcast(currentConfig,WifiManager.CHANGE_REASON_CONFIG_CHANGE);
}
return new NetworkUpdateResult(ipChanged,proxyChanged);
}