Program: 20902
Project: 20902
Buggy source:
@Override public void onRouteAdded(MediaRouter router,RouteInfo route){
  super.onRouteAdded(router,route);
  CastDevice castDevice=CastDevice.getFromBundle(route.getExtras());
  String ipAddress=castDevice.getIpAddress().getHostAddress();
  String uuid=castDevice.getDeviceId();
  String friendlyName=castDevice.getFriendlyName();
  String modelName=castDevice.getModelName();
  String modelNumber=castDevice.getDeviceVersion();
  int port=castDevice.getServicePort();
  String modelDescription=route.getDescription();
  String serviceFilter="String_Node_Str";
  ServiceDescription oldService=services.get(uuid);
  ServiceDescription newService;
  if (oldService == null) {
    newService=new CastServiceDescription(serviceFilter,uuid,ipAddress,castDevice);
    newService.setFriendlyName(friendlyName);
    newService.setModelName(modelName);
    newService.setModelNumber(modelNumber);
    newService.setModelDescription(modelDescription);
    newService.setPort(port);
    services.put(uuid,newService);
  }
 else {
    newService=oldService;
    newService.setIpAddress(ipAddress);
    newService.setFriendlyName(friendlyName);
    newService.setModelName(modelName);
    newService.setModelNumber(modelNumber);
    newService.setModelDescription(modelDescription);
    newService.setPort(port);
    ((CastServiceDescription)newService).setCastDevice(castDevice);
    services.put(uuid,newService);
  }
  for (  DiscoveryProviderListener listenter : serviceListeners) {
    listenter.onServiceAdded(CastDiscoveryProvider.this,newService);
  }
}

Fixed version (ground truth):
@Override public void onRouteAdded(MediaRouter router,RouteInfo route){
  super.onRouteAdded(router,route);
  CastDevice castDevice=CastDevice.getFromBundle(route.getExtras());
  String ipAddress=castDevice.getIpAddress().getHostAddress();
  String uuid=castDevice.getDeviceId();
  String friendlyName=castDevice.getFriendlyName();
  String modelName=castDevice.getModelName();
  String modelNumber=castDevice.getDeviceVersion();
  int port=castDevice.getServicePort();
  String modelDescription=route.getDescription();
  String serviceFilter="String_Node_Str";
  ServiceDescription oldService=services.get(uuid);
  ServiceDescription newService;
  if (oldService == null) {
    newService=new CastServiceDescription(serviceFilter,uuid,ipAddress,castDevice);
    newService.setFriendlyName(friendlyName);
    newService.setModelName(modelName);
    newService.setModelNumber(modelNumber);
    newService.setModelDescription(modelDescription);
    newService.setPort(port);
    newService.setServiceID(CastService.ID);
    services.put(uuid,newService);
  }
 else {
    newService=oldService;
    newService.setIpAddress(ipAddress);
    newService.setFriendlyName(friendlyName);
    newService.setModelName(modelName);
    newService.setModelNumber(modelNumber);
    newService.setModelDescription(modelDescription);
    newService.setPort(port);
    newService.setServiceID(CastService.ID);
    ((CastServiceDescription)newService).setCastDevice(castDevice);
    services.put(uuid,newService);
  }
  for (  DiscoveryProviderListener listenter : serviceListeners) {
    listenter.onServiceAdded(CastDiscoveryProvider.this,newService);
  }
}