Program: 23755
Project: 23755
Buggy source:
public void onLocationChanged(Location loc){
  if (loc.getProvider().equals(LocationManager.GPS_PROVIDER)) {
    isGpsAvailable=true;
  }
  if (isGpsAvailable && loc.getProvider().equals(LocationManager.NETWORK_PROVIDER)) {
    return;
  }
  long now=System.currentTimeMillis();
  double latitude=loc.getLatitude();
  double longitude=loc.getLongitude();
  ArrayList<PendingIntent> intentsToRemove=null;
  for (  ProximityAlert alert : mProximityAlerts.values()) {
    PendingIntent intent=alert.getIntent();
    long expiration=alert.getExpiration();
    if ((expiration == -1) || (now <= expiration)) {
      boolean entered=mProximitiesEntered.contains(alert);
      boolean inProximity=alert.isInProximity(latitude,longitude);
      if (!entered && inProximity) {
        if (LOCAL_LOGV) {
          Log.v(TAG,"String_Node_Str");
        }
        mProximitiesEntered.add(alert);
        Intent enteredIntent=new Intent();
        enteredIntent.putExtra(LocationManager.KEY_PROXIMITY_ENTERING,true);
        try {
synchronized (this) {
            intent.send(mContext,0,enteredIntent,this,mLocationHandler);
            incrementPendingBroadcasts();
          }
        }
 catch (        PendingIntent.CanceledException e) {
          if (LOCAL_LOGV) {
            Log.v(TAG,"String_Node_Str" + alert,e);
          }
          if (intentsToRemove == null) {
            intentsToRemove=new ArrayList<PendingIntent>();
          }
          intentsToRemove.add(intent);
        }
      }
 else       if (entered && !inProximity) {
        if (LOCAL_LOGV) {
          Log.v(TAG,"String_Node_Str");
        }
        mProximitiesEntered.remove(alert);
        Intent exitedIntent=new Intent();
        exitedIntent.putExtra(LocationManager.KEY_PROXIMITY_ENTERING,false);
        try {
synchronized (this) {
            intent.send(mContext,0,exitedIntent,this,mLocationHandler);
            incrementPendingBroadcasts();
          }
        }
 catch (        PendingIntent.CanceledException e) {
          if (LOCAL_LOGV) {
            Log.v(TAG,"String_Node_Str" + alert,e);
          }
          if (intentsToRemove == null) {
            intentsToRemove=new ArrayList<PendingIntent>();
          }
          intentsToRemove.add(intent);
        }
      }
    }
 else {
      if (LOCAL_LOGV) {
        Log.v(TAG,"String_Node_Str" + alert);
      }
      if (intentsToRemove == null) {
        intentsToRemove=new ArrayList<PendingIntent>();
      }
      intentsToRemove.add(alert.getIntent());
    }
  }
  if (intentsToRemove != null) {
    for (    PendingIntent i : intentsToRemove) {
      mProximityAlerts.remove(i);
      ProximityAlert alert=mProximityAlerts.get(i);
      mProximitiesEntered.remove(alert);
    }
  }
}

Fixed version (ground truth):
public void onLocationChanged(Location loc){
  if (loc.getProvider().equals(LocationManager.GPS_PROVIDER)) {
    isGpsAvailable=true;
  }
  if (isGpsAvailable && loc.getProvider().equals(LocationManager.NETWORK_PROVIDER)) {
    return;
  }
  long now=System.currentTimeMillis();
  double latitude=loc.getLatitude();
  double longitude=loc.getLongitude();
  float accuracy=loc.getAccuracy();
  ArrayList<PendingIntent> intentsToRemove=null;
  for (  ProximityAlert alert : mProximityAlerts.values()) {
    PendingIntent intent=alert.getIntent();
    long expiration=alert.getExpiration();
    if ((expiration == -1) || (now <= expiration)) {
      boolean entered=mProximitiesEntered.contains(alert);
      boolean inProximity=alert.isInProximity(latitude,longitude,accuracy);
      if (!entered && inProximity) {
        if (LOCAL_LOGV) {
          Log.v(TAG,"String_Node_Str");
        }
        mProximitiesEntered.add(alert);
        Intent enteredIntent=new Intent();
        enteredIntent.putExtra(LocationManager.KEY_PROXIMITY_ENTERING,true);
        try {
synchronized (this) {
            intent.send(mContext,0,enteredIntent,this,mLocationHandler);
            incrementPendingBroadcasts();
          }
        }
 catch (        PendingIntent.CanceledException e) {
          if (LOCAL_LOGV) {
            Log.v(TAG,"String_Node_Str" + alert,e);
          }
          if (intentsToRemove == null) {
            intentsToRemove=new ArrayList<PendingIntent>();
          }
          intentsToRemove.add(intent);
        }
      }
 else       if (entered && !inProximity) {
        if (LOCAL_LOGV) {
          Log.v(TAG,"String_Node_Str");
        }
        mProximitiesEntered.remove(alert);
        Intent exitedIntent=new Intent();
        exitedIntent.putExtra(LocationManager.KEY_PROXIMITY_ENTERING,false);
        try {
synchronized (this) {
            intent.send(mContext,0,exitedIntent,this,mLocationHandler);
            incrementPendingBroadcasts();
          }
        }
 catch (        PendingIntent.CanceledException e) {
          if (LOCAL_LOGV) {
            Log.v(TAG,"String_Node_Str" + alert,e);
          }
          if (intentsToRemove == null) {
            intentsToRemove=new ArrayList<PendingIntent>();
          }
          intentsToRemove.add(intent);
        }
      }
    }
 else {
      if (LOCAL_LOGV) {
        Log.v(TAG,"String_Node_Str" + alert);
      }
      if (intentsToRemove == null) {
        intentsToRemove=new ArrayList<PendingIntent>();
      }
      intentsToRemove.add(alert.getIntent());
    }
  }
  if (intentsToRemove != null) {
    for (    PendingIntent i : intentsToRemove) {
      mProximityAlerts.remove(i);
      ProximityAlert alert=mProximityAlerts.get(i);
      mProximitiesEntered.remove(alert);
    }
  }
}