nus-yam/ex-repair huggingface dataset:
Program: 183307
Project: 183307
Buggy source:
public void addTestProvider(String name,boolean requiresNetwork,boolean requiresSatellite,boolean requiresCell,boolean hasMonetaryCost,boolean supportsAltitude,boolean supportsSpeed,boolean supportsBearing,int powerRequirement,int accuracy){
  checkMockPermissionsSafe();
synchronized (mLock) {
    MockProvider provider=new MockProvider(name,this,requiresNetwork,requiresSatellite,requiresCell,hasMonetaryCost,supportsAltitude,supportsSpeed,supportsBearing,powerRequirement,accuracy);
    if (mProvidersByName.get(name) != null) {
      throw new IllegalArgumentException("String_Node_Str" + name + "String_Node_Str");
    }
    long identity=Binder.clearCallingIdentity();
    addProvider(new LocationProviderProxy(name,provider));
    mMockProviders.put(name,provider);
    updateProvidersLocked();
    Binder.restoreCallingIdentity(identity);
  }
}

Fixed version (ground truth):
public void addTestProvider(String name,boolean requiresNetwork,boolean requiresSatellite,boolean requiresCell,boolean hasMonetaryCost,boolean supportsAltitude,boolean supportsSpeed,boolean supportsBearing,int powerRequirement,int accuracy){
  checkMockPermissionsSafe();
synchronized (mLock) {
    MockProvider provider=new MockProvider(name,this,requiresNetwork,requiresSatellite,requiresCell,hasMonetaryCost,supportsAltitude,supportsSpeed,supportsBearing,powerRequirement,accuracy);
    if (LocationManager.GPS_PROVIDER.equals(name) || LocationManager.NETWORK_PROVIDER.equals(name)) {
      LocationProviderProxy proxy=mProvidersByName.get(name);
      if (proxy != null) {
        proxy.enableLocationTracking(false);
        removeProvider(proxy);
      }
    }
    if (mProvidersByName.get(name) != null) {
      throw new IllegalArgumentException("String_Node_Str" + name + "String_Node_Str");
    }
    addProvider(new LocationProviderProxy(name,provider));
    mMockProviders.put(name,provider);
    mLastKnownLocation.put(name,null);
    updateProvidersLocked();
  }
}
Program: 183308
Project: 183308
Buggy source:
public void removeTestProvider(String provider){
  checkMockPermissionsSafe();
synchronized (mLock) {
    MockProvider mockProvider=mMockProviders.get(provider);
    if (mockProvider == null) {
      throw new IllegalArgumentException("String_Node_Str" + provider + "String_Node_Str");
    }
    removeProvider(mProvidersByName.get(provider));
    mMockProviders.remove(mockProvider);
    updateProvidersLocked();
  }
}

Fixed version (ground truth):
public void removeTestProvider(String provider){
  checkMockPermissionsSafe();
synchronized (mLock) {
    MockProvider mockProvider=mMockProviders.get(provider);
    if (mockProvider == null) {
      throw new IllegalArgumentException("String_Node_Str" + provider + "String_Node_Str");
    }
    removeProvider(mProvidersByName.get(provider));
    mMockProviders.remove(mockProvider);
    if (LocationManager.GPS_PROVIDER.equals(provider) && mGpsLocationProvider != null) {
      addProvider(mGpsLocationProvider);
    }
 else     if (LocationManager.NETWORK_PROVIDER.equals(provider) && mNetworkLocationProvider != null) {
      addProvider(mNetworkLocationProvider);
    }
    mLastKnownLocation.put(provider,null);
    updateProvidersLocked();
  }
}
Program: 183309
Project: 183309
Buggy source:
private void _loadProvidersLocked(){
  if (GpsLocationProvider.isSupported()) {
    GpsLocationProvider provider=new GpsLocationProvider(mContext,this);
    mGpsStatusProvider=provider.getGpsStatusProvider();
    LocationProviderProxy proxy=new LocationProviderProxy(LocationManager.GPS_PROVIDER,provider);
    addProvider(proxy);
  }
  updateProvidersLocked();
}

Fixed version (ground truth):
private void _loadProvidersLocked(){
  if (GpsLocationProvider.isSupported()) {
    GpsLocationProvider provider=new GpsLocationProvider(mContext,this);
    mGpsStatusProvider=provider.getGpsStatusProvider();
    LocationProviderProxy proxy=new LocationProviderProxy(LocationManager.GPS_PROVIDER,provider);
    addProvider(proxy);
    mGpsLocationProvider=proxy;
  }
  updateProvidersLocked();
}
Program: 183310
Project: 183310
Buggy source:
public void installLocationProvider(String name,ILocationProvider provider){
  if (mContext.checkCallingOrSelfPermission(INSTALL_LOCATION_PROVIDER) != PackageManager.PERMISSION_GRANTED) {
    throw new SecurityException("String_Node_Str");
  }
synchronized (mLock) {
    LocationProviderProxy oldProvider=mProvidersByName.get(name);
    if (oldProvider != null) {
      if (oldProvider.isDead()) {
        Log.d(TAG,"String_Node_Str");
        removeProvider(oldProvider);
      }
 else {
        throw new IllegalArgumentException("String_Node_Str" + name + "String_Node_Str");
      }
    }
    LocationProviderProxy proxy=new LocationProviderProxy(name,provider);
    addProvider(proxy);
    updateProvidersLocked();
    proxy.updateNetworkState(mNetworkState);
  }
}

Fixed version (ground truth):
public void installLocationProvider(String name,ILocationProvider provider){
  if (mContext.checkCallingOrSelfPermission(INSTALL_LOCATION_PROVIDER) != PackageManager.PERMISSION_GRANTED) {
    throw new SecurityException("String_Node_Str");
  }
synchronized (mLock) {
    LocationProviderProxy oldProvider=mProvidersByName.get(name);
    if (oldProvider != null) {
      if (oldProvider.isDead()) {
        Log.d(TAG,"String_Node_Str");
        removeProvider(oldProvider);
      }
 else {
        throw new IllegalArgumentException("String_Node_Str" + name + "String_Node_Str");
      }
    }
    LocationProviderProxy proxy=new LocationProviderProxy(name,provider);
    addProvider(proxy);
    updateProvidersLocked();
    if (LocationManager.NETWORK_PROVIDER.equals(name)) {
      mNetworkLocationProvider=proxy;
    }
    proxy.updateNetworkState(mNetworkState);
  }
}
Program: 183311
Project: 183311
Buggy source:
public void addTestProvider(String name,boolean requiresNetwork,boolean requiresSatellite,boolean requiresCell,boolean hasMonetaryCost,boolean supportsAltitude,boolean supportsSpeed,boolean supportsBearing,int powerRequirement,int accuracy){
  checkMockPermissionsSafe();
synchronized (mLock) {
    MockProvider provider=new MockProvider(name,this,requiresNetwork,requiresSatellite,requiresCell,hasMonetaryCost,supportsAltitude,supportsSpeed,supportsBearing,powerRequirement,accuracy);
    if (mProvidersByName.get(name) != null) {
      throw new IllegalArgumentException("String_Node_Str" + name + "String_Node_Str");
    }
    long identity=Binder.clearCallingIdentity();
    addProvider(new LocationProviderProxy(name,provider));
    mMockProviders.put(name,provider);
    updateProvidersLocked();
    Binder.restoreCallingIdentity(identity);
  }
}

Fixed version (ground truth):
public void addTestProvider(String name,boolean requiresNetwork,boolean requiresSatellite,boolean requiresCell,boolean hasMonetaryCost,boolean supportsAltitude,boolean supportsSpeed,boolean supportsBearing,int powerRequirement,int accuracy){
  checkMockPermissionsSafe();
synchronized (mLock) {
    MockProvider provider=new MockProvider(name,this,requiresNetwork,requiresSatellite,requiresCell,hasMonetaryCost,supportsAltitude,supportsSpeed,supportsBearing,powerRequirement,accuracy);
    if (LocationManager.GPS_PROVIDER.equals(name) || LocationManager.NETWORK_PROVIDER.equals(name)) {
      LocationProviderProxy proxy=mProvidersByName.get(name);
      if (proxy != null) {
        proxy.enableLocationTracking(false);
        removeProvider(proxy);
      }
    }
    if (mProvidersByName.get(name) != null) {
      throw new IllegalArgumentException("String_Node_Str" + name + "String_Node_Str");
    }
    addProvider(new LocationProviderProxy(name,provider));
    mMockProviders.put(name,provider);
    mLastKnownLocation.put(name,null);
    updateProvidersLocked();
  }
}
Program: 183312
Project: 183312
Buggy source:
public void removeTestProvider(String provider){
  checkMockPermissionsSafe();
synchronized (mLock) {
    MockProvider mockProvider=mMockProviders.get(provider);
    if (mockProvider == null) {
      throw new IllegalArgumentException("String_Node_Str" + provider + "String_Node_Str");
    }
    removeProvider(mProvidersByName.get(provider));
    mMockProviders.remove(mockProvider);
    updateProvidersLocked();
  }
}

Fixed version (ground truth):
public void removeTestProvider(String provider){
  checkMockPermissionsSafe();
synchronized (mLock) {
    MockProvider mockProvider=mMockProviders.get(provider);
    if (mockProvider == null) {
      throw new IllegalArgumentException("String_Node_Str" + provider + "String_Node_Str");
    }
    removeProvider(mProvidersByName.get(provider));
    mMockProviders.remove(mockProvider);
    if (LocationManager.GPS_PROVIDER.equals(provider) && mGpsLocationProvider != null) {
      addProvider(mGpsLocationProvider);
    }
 else     if (LocationManager.NETWORK_PROVIDER.equals(provider) && mNetworkLocationProvider != null) {
      addProvider(mNetworkLocationProvider);
    }
    mLastKnownLocation.put(provider,null);
    updateProvidersLocked();
  }
}
Program: 183313
Project: 183313
Buggy source:
private void _loadProvidersLocked(){
  if (GpsLocationProvider.isSupported()) {
    GpsLocationProvider provider=new GpsLocationProvider(mContext,this);
    mGpsStatusProvider=provider.getGpsStatusProvider();
    LocationProviderProxy proxy=new LocationProviderProxy(LocationManager.GPS_PROVIDER,provider);
    addProvider(proxy);
  }
  updateProvidersLocked();
}

Fixed version (ground truth):
private void _loadProvidersLocked(){
  if (GpsLocationProvider.isSupported()) {
    GpsLocationProvider provider=new GpsLocationProvider(mContext,this);
    mGpsStatusProvider=provider.getGpsStatusProvider();
    LocationProviderProxy proxy=new LocationProviderProxy(LocationManager.GPS_PROVIDER,provider);
    addProvider(proxy);
    mGpsLocationProvider=proxy;
  }
  updateProvidersLocked();
}
Program: 183316
Project: 183316
Buggy source:
/** 
 * SSL certificate error callback. Handles SSL error(s) on the way up to the user. IMPORTANT: as this is called from network thread, can't call native directly
 */
public boolean handleSslErrorRequest(SslError error){
  if (DebugFlags.LOAD_LISTENER) {
    Log.v(LOGTAG,"String_Node_Str" + url() + "String_Node_Str"+ error.getPrimaryError()+ "String_Node_Str"+ error.getCertificate());
  }
  sendMessageInternal(obtainMessage(MSG_SSL_ERROR,error));
  if (!mCancelled) {
    mSslErrorRequestHandle=mRequestHandle;
  }
  return !mCancelled;
}

Fixed version (ground truth):
/** 
 * SSL certificate error callback. Handles SSL error(s) on the way up to the user. IMPORTANT: as this is called from network thread, can't call native directly
 */
public boolean handleSslErrorRequest(SslError error){
  if (DebugFlags.LOAD_LISTENER) {
    Log.v(LOGTAG,"String_Node_Str" + url() + "String_Node_Str"+ error.getPrimaryError()+ "String_Node_Str"+ error.getCertificate());
  }
  if (Network.getInstance(mContext).checkSslPrefTable(this,error)) {
    return true;
  }
  if (isSynchronous()) {
    mRequestHandle.handleSslErrorResponse(false);
    return true;
  }
  sendMessageInternal(obtainMessage(MSG_SSL_ERROR,error));
  if (!mCancelled) {
    mSslErrorRequestHandle=mRequestHandle;
  }
  return !mCancelled;
}
Program: 183317
Project: 183317
Buggy source:
/** 
 * Cancel this request and all pending requests for the WebView that had the error.
 */
public void cancel(){
  sendMessage(obtainMessage(HANDLE_RESPONSE,0,0));
}

Fixed version (ground truth):
/** 
 * Cancel this request and all pending requests for the WebView that had the error.
 */
public void cancel(){
  sendMessage(obtainMessage(HANDLE_RESPONSE,0,0,mLoaderQueue.poll()));
}
Program: 183318
Project: 183318
Buggy source:
/** 
 * Handles SSL error(s) on the way down from the user.
 */
synchronized void handleSslErrorResponse(boolean proceed){
  LoadListener loader=mLoaderQueue.poll();
  if (DebugFlags.SSL_ERROR_HANDLER) {
    Assert.assertNotNull(loader);
  }
  if (DebugFlags.SSL_ERROR_HANDLER) {
    Log.v(LOGTAG,"String_Node_Str" + "String_Node_Str" + proceed + "String_Node_Str"+ loader.url());
  }
  if (!loader.cancelled()) {
    if (proceed) {
      int primary=loader.sslError().getPrimaryError();
      String host=loader.host();
      if (DebugFlags.SSL_ERROR_HANDLER) {
        Assert.assertTrue(host != null && primary != 0);
      }
      boolean hasKey=mSslPrefTable.containsKey(host);
      if (!hasKey || primary > mSslPrefTable.getInt(host)) {
        mSslPrefTable.putInt(host,primary);
      }
    }
    loader.handleSslErrorResponse(proceed);
  }
}

Fixed version (ground truth):
/** 
 * Handles SSL error(s) on the way down from the user.
 */
synchronized void handleSslErrorResponse(LoadListener loader,SslError error,boolean proceed){
  if (DebugFlags.SSL_ERROR_HANDLER) {
    Assert.assertNotNull(loader);
    Assert.assertNotNull(error);
  }
  if (DebugFlags.SSL_ERROR_HANDLER) {
    Log.v(LOGTAG,"String_Node_Str" + "String_Node_Str" + proceed + "String_Node_Str"+ loader.url());
  }
  if (!loader.cancelled()) {
    if (proceed) {
      int primary=error.getPrimaryError();
      String host=loader.host();
      if (DebugFlags.SSL_ERROR_HANDLER) {
        Assert.assertTrue(host != null && primary != 0);
      }
      boolean hasKey=mSslPrefTable.containsKey(host);
      if (!hasKey || primary > mSslPrefTable.getInt(host)) {
        mSslPrefTable.putInt(host,primary);
      }
    }
    loader.handleSslErrorResponse(proceed);
  }
}
Program: 183319
Project: 183319
Buggy source:
/** 
 * Restores this handler's state from a map.
 * @return True iff succeeds.
 */
boolean restoreState(Bundle inState){
  boolean success=(inState != null);
  if (success) {
    success=inState.containsKey("String_Node_Str");
    if (success) {
      mSslPrefTable=inState.getBundle("String_Node_Str");
    }
  }
  return success;
}

Fixed version (ground truth):
/** 
 * Restores this handler's state from a map.
 * @return True iff succeeds.
 */
synchronized boolean restoreState(Bundle inState){
  boolean success=(inState != null);
  if (success) {
    success=inState.containsKey("String_Node_Str");
    if (success) {
      mSslPrefTable=inState.getBundle("String_Node_Str");
    }
  }
  return success;
}
Program: 183320
Project: 183320
Buggy source:
/** 
 * Proceed with the SSL certificate.
 */
public void proceed(){
  sendMessage(obtainMessage(HANDLE_RESPONSE,1,0));
}

Fixed version (ground truth):
/** 
 * Proceed with the SSL certificate.
 */
public void proceed(){
  sendMessage(obtainMessage(HANDLE_RESPONSE,1,0,mLoaderQueue.poll()));
}
Program: 183321
Project: 183321
Buggy source:
/** 
 * Saves this handler's state into a map.
 * @return True iff succeeds.
 */
boolean saveState(Bundle outState){
  boolean success=(outState != null);
  if (success) {
    outState.putBundle("String_Node_Str",mSslPrefTable);
  }
  return success;
}

Fixed version (ground truth):
/** 
 * Saves this handler's state into a map.
 * @return True iff succeeds.
 */
synchronized boolean saveState(Bundle outState){
  boolean success=(outState != null);
  if (success) {
    outState.putBundle("String_Node_Str",mSslPrefTable);
  }
  return success;
}
Program: 183322
Project: 183322
Buggy source:
/** 
 * Processes the next loader in the queue.
 * @return True iff should proceed to processing thefollowing loader in the queue
 */
private synchronized boolean processNextLoader(){
  LoadListener loader=mLoaderQueue.peek();
  if (loader != null) {
    if (loader.cancelled()) {
      return true;
    }
    SslError error=loader.sslError();
    if (DebugFlags.SSL_ERROR_HANDLER) {
      Assert.assertNotNull(error);
    }
    int primary=error.getPrimaryError();
    String host=loader.host();
    if (DebugFlags.SSL_ERROR_HANDLER) {
      Assert.assertTrue(host != null && primary != 0);
    }
    if (mSslPrefTable.containsKey(host)) {
      if (primary <= mSslPrefTable.getInt(host)) {
        handleSslErrorResponse(true);
        return true;
      }
    }
    CallbackProxy proxy=loader.getFrame().getCallbackProxy();
    proxy.onReceivedSslError(this,error);
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Processes the next loader in the queue.
 * @return True iff should proceed to processing thefollowing loader in the queue
 */
private synchronized boolean processNextLoader(){
  LoadListener loader=mLoaderQueue.peek();
  if (loader != null) {
    if (loader.cancelled()) {
      mLoaderQueue.remove(loader);
      return true;
    }
    SslError error=loader.sslError();
    if (DebugFlags.SSL_ERROR_HANDLER) {
      Assert.assertNotNull(error);
    }
    if (checkSslPrefTable(loader,error)) {
      mLoaderQueue.remove(loader);
      return true;
    }
    CallbackProxy proxy=loader.getFrame().getCallbackProxy();
    proxy.onReceivedSslError(this,error);
  }
  return false;
}
Program: 183323
Project: 183323
Buggy source:
@Override public void handleMessage(Message msg){
switch (msg.what) {
case HANDLE_RESPONSE:
    handleSslErrorResponse(msg.arg1 == 1);
  fastProcessQueuedSslErrors();
break;
}
}

Fixed version (ground truth):
@Override public void handleMessage(Message msg){
switch (msg.what) {
case HANDLE_RESPONSE:
    LoadListener loader=(LoadListener)msg.obj;
  handleSslErrorResponse(loader,loader.sslError(),msg.arg1 == 1);
fastProcessQueuedSslErrors();
break;
}
}
Program: 183324
Project: 183324
Buggy source:
/** 
 * SSL certificate error callback. Handles SSL error(s) on the way up to the user. IMPORTANT: as this is called from network thread, can't call native directly
 */
public boolean handleSslErrorRequest(SslError error){
  if (DebugFlags.LOAD_LISTENER) {
    Log.v(LOGTAG,"String_Node_Str" + url() + "String_Node_Str"+ error.getPrimaryError()+ "String_Node_Str"+ error.getCertificate());
  }
  sendMessageInternal(obtainMessage(MSG_SSL_ERROR,error));
  if (!mCancelled) {
    mSslErrorRequestHandle=mRequestHandle;
  }
  return !mCancelled;
}

Fixed version (ground truth):
/** 
 * SSL certificate error callback. Handles SSL error(s) on the way up to the user. IMPORTANT: as this is called from network thread, can't call native directly
 */
public boolean handleSslErrorRequest(SslError error){
  if (DebugFlags.LOAD_LISTENER) {
    Log.v(LOGTAG,"String_Node_Str" + url() + "String_Node_Str"+ error.getPrimaryError()+ "String_Node_Str"+ error.getCertificate());
  }
  if (Network.getInstance(mContext).checkSslPrefTable(this,error)) {
    return true;
  }
  if (isSynchronous()) {
    mRequestHandle.handleSslErrorResponse(false);
    return true;
  }
  sendMessageInternal(obtainMessage(MSG_SSL_ERROR,error));
  if (!mCancelled) {
    mSslErrorRequestHandle=mRequestHandle;
  }
  return !mCancelled;
}
Program: 183325
Project: 183325
Buggy source:
/** 
 * Cancel this request and all pending requests for the WebView that had the error.
 */
public void cancel(){
  sendMessage(obtainMessage(HANDLE_RESPONSE,0,0));
}

Fixed version (ground truth):
/** 
 * Cancel this request and all pending requests for the WebView that had the error.
 */
public void cancel(){
  sendMessage(obtainMessage(HANDLE_RESPONSE,0,0,mLoaderQueue.poll()));
}
Program: 183326
Project: 183326
Buggy source:
/** 
 * Handles SSL error(s) on the way down from the user.
 */
synchronized void handleSslErrorResponse(boolean proceed){
  LoadListener loader=mLoaderQueue.poll();
  if (DebugFlags.SSL_ERROR_HANDLER) {
    Assert.assertNotNull(loader);
  }
  if (DebugFlags.SSL_ERROR_HANDLER) {
    Log.v(LOGTAG,"String_Node_Str" + "String_Node_Str" + proceed + "String_Node_Str"+ loader.url());
  }
  if (!loader.cancelled()) {
    if (proceed) {
      int primary=loader.sslError().getPrimaryError();
      String host=loader.host();
      if (DebugFlags.SSL_ERROR_HANDLER) {
        Assert.assertTrue(host != null && primary != 0);
      }
      boolean hasKey=mSslPrefTable.containsKey(host);
      if (!hasKey || primary > mSslPrefTable.getInt(host)) {
        mSslPrefTable.putInt(host,primary);
      }
    }
    loader.handleSslErrorResponse(proceed);
  }
}

Fixed version (ground truth):
/** 
 * Handles SSL error(s) on the way down from the user.
 */
synchronized void handleSslErrorResponse(LoadListener loader,SslError error,boolean proceed){
  if (DebugFlags.SSL_ERROR_HANDLER) {
    Assert.assertNotNull(loader);
    Assert.assertNotNull(error);
  }
  if (DebugFlags.SSL_ERROR_HANDLER) {
    Log.v(LOGTAG,"String_Node_Str" + "String_Node_Str" + proceed + "String_Node_Str"+ loader.url());
  }
  if (!loader.cancelled()) {
    if (proceed) {
      int primary=error.getPrimaryError();
      String host=loader.host();
      if (DebugFlags.SSL_ERROR_HANDLER) {
        Assert.assertTrue(host != null && primary != 0);
      }
      boolean hasKey=mSslPrefTable.containsKey(host);
      if (!hasKey || primary > mSslPrefTable.getInt(host)) {
        mSslPrefTable.putInt(host,primary);
      }
    }
    loader.handleSslErrorResponse(proceed);
  }
}
Program: 183327
Project: 183327
Buggy source:
/** 
 * Restores this handler's state from a map.
 * @return True iff succeeds.
 */
boolean restoreState(Bundle inState){
  boolean success=(inState != null);
  if (success) {
    success=inState.containsKey("String_Node_Str");
    if (success) {
      mSslPrefTable=inState.getBundle("String_Node_Str");
    }
  }
  return success;
}

Fixed version (ground truth):
/** 
 * Restores this handler's state from a map.
 * @return True iff succeeds.
 */
synchronized boolean restoreState(Bundle inState){
  boolean success=(inState != null);
  if (success) {
    success=inState.containsKey("String_Node_Str");
    if (success) {
      mSslPrefTable=inState.getBundle("String_Node_Str");
    }
  }
  return success;
}
Program: 183328
Project: 183328
Buggy source:
/** 
 * Proceed with the SSL certificate.
 */
public void proceed(){
  sendMessage(obtainMessage(HANDLE_RESPONSE,1,0));
}

Fixed version (ground truth):
/** 
 * Proceed with the SSL certificate.
 */
public void proceed(){
  sendMessage(obtainMessage(HANDLE_RESPONSE,1,0,mLoaderQueue.poll()));
}
Program: 183329
Project: 183329
Buggy source:
/** 
 * Saves this handler's state into a map.
 * @return True iff succeeds.
 */
boolean saveState(Bundle outState){
  boolean success=(outState != null);
  if (success) {
    outState.putBundle("String_Node_Str",mSslPrefTable);
  }
  return success;
}

Fixed version (ground truth):
/** 
 * Saves this handler's state into a map.
 * @return True iff succeeds.
 */
synchronized boolean saveState(Bundle outState){
  boolean success=(outState != null);
  if (success) {
    outState.putBundle("String_Node_Str",mSslPrefTable);
  }
  return success;
}
Program: 183330
Project: 183330
Buggy source:
/** 
 * Processes the next loader in the queue.
 * @return True iff should proceed to processing thefollowing loader in the queue
 */
private synchronized boolean processNextLoader(){
  LoadListener loader=mLoaderQueue.peek();
  if (loader != null) {
    if (loader.cancelled()) {
      return true;
    }
    SslError error=loader.sslError();
    if (DebugFlags.SSL_ERROR_HANDLER) {
      Assert.assertNotNull(error);
    }
    int primary=error.getPrimaryError();
    String host=loader.host();
    if (DebugFlags.SSL_ERROR_HANDLER) {
      Assert.assertTrue(host != null && primary != 0);
    }
    if (mSslPrefTable.containsKey(host)) {
      if (primary <= mSslPrefTable.getInt(host)) {
        handleSslErrorResponse(true);
        return true;
      }
    }
    CallbackProxy proxy=loader.getFrame().getCallbackProxy();
    proxy.onReceivedSslError(this,error);
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Processes the next loader in the queue.
 * @return True iff should proceed to processing thefollowing loader in the queue
 */
private synchronized boolean processNextLoader(){
  LoadListener loader=mLoaderQueue.peek();
  if (loader != null) {
    if (loader.cancelled()) {
      mLoaderQueue.remove(loader);
      return true;
    }
    SslError error=loader.sslError();
    if (DebugFlags.SSL_ERROR_HANDLER) {
      Assert.assertNotNull(error);
    }
    if (checkSslPrefTable(loader,error)) {
      mLoaderQueue.remove(loader);
      return true;
    }
    CallbackProxy proxy=loader.getFrame().getCallbackProxy();
    proxy.onReceivedSslError(this,error);
  }
  return false;
}
Program: 183331
Project: 183331
Buggy source:
@Override public void handleMessage(Message msg){
switch (msg.what) {
case HANDLE_RESPONSE:
    handleSslErrorResponse(msg.arg1 == 1);
  fastProcessQueuedSslErrors();
break;
}
}

Fixed version (ground truth):
@Override public void handleMessage(Message msg){
switch (msg.what) {
case HANDLE_RESPONSE:
    LoadListener loader=(LoadListener)msg.obj;
  handleSslErrorResponse(loader,loader.sslError(),msg.arg1 == 1);
fastProcessQueuedSslErrors();
break;
}
}
Program: 183332
Project: 183332
Buggy source:
/** 
 * SSL certificate error callback. Handles SSL error(s) on the way up to the user. IMPORTANT: as this is called from network thread, can't call native directly
 */
public boolean handleSslErrorRequest(SslError error){
  if (DebugFlags.LOAD_LISTENER) {
    Log.v(LOGTAG,"String_Node_Str" + url() + "String_Node_Str"+ error.getPrimaryError()+ "String_Node_Str"+ error.getCertificate());
  }
  sendMessageInternal(obtainMessage(MSG_SSL_ERROR,error));
  if (!mCancelled) {
    mSslErrorRequestHandle=mRequestHandle;
  }
  return !mCancelled;
}

Fixed version (ground truth):
/** 
 * SSL certificate error callback. Handles SSL error(s) on the way up to the user. IMPORTANT: as this is called from network thread, can't call native directly
 */
public boolean handleSslErrorRequest(SslError error){
  if (DebugFlags.LOAD_LISTENER) {
    Log.v(LOGTAG,"String_Node_Str" + url() + "String_Node_Str"+ error.getPrimaryError()+ "String_Node_Str"+ error.getCertificate());
  }
  if (Network.getInstance(mContext).checkSslPrefTable(this,error)) {
    return true;
  }
  if (isSynchronous()) {
    mRequestHandle.handleSslErrorResponse(false);
    return true;
  }
  sendMessageInternal(obtainMessage(MSG_SSL_ERROR,error));
  if (!mCancelled) {
    mSslErrorRequestHandle=mRequestHandle;
  }
  return !mCancelled;
}
Program: 183333
Project: 183333
Buggy source:
/** 
 * Cancel this request and all pending requests for the WebView that had the error.
 */
public void cancel(){
  sendMessage(obtainMessage(HANDLE_RESPONSE,0,0));
}

Fixed version (ground truth):
/** 
 * Cancel this request and all pending requests for the WebView that had the error.
 */
public void cancel(){
  sendMessage(obtainMessage(HANDLE_RESPONSE,0,0,mLoaderQueue.poll()));
}
Program: 183334
Project: 183334
Buggy source:
/** 
 * Handles SSL error(s) on the way down from the user.
 */
synchronized void handleSslErrorResponse(boolean proceed){
  LoadListener loader=mLoaderQueue.poll();
  if (DebugFlags.SSL_ERROR_HANDLER) {
    Assert.assertNotNull(loader);
  }
  if (DebugFlags.SSL_ERROR_HANDLER) {
    Log.v(LOGTAG,"String_Node_Str" + "String_Node_Str" + proceed + "String_Node_Str"+ loader.url());
  }
  if (!loader.cancelled()) {
    if (proceed) {
      int primary=loader.sslError().getPrimaryError();
      String host=loader.host();
      if (DebugFlags.SSL_ERROR_HANDLER) {
        Assert.assertTrue(host != null && primary != 0);
      }
      boolean hasKey=mSslPrefTable.containsKey(host);
      if (!hasKey || primary > mSslPrefTable.getInt(host)) {
        mSslPrefTable.putInt(host,primary);
      }
    }
    loader.handleSslErrorResponse(proceed);
  }
}

Fixed version (ground truth):
/** 
 * Handles SSL error(s) on the way down from the user.
 */
synchronized void handleSslErrorResponse(LoadListener loader,SslError error,boolean proceed){
  if (DebugFlags.SSL_ERROR_HANDLER) {
    Assert.assertNotNull(loader);
    Assert.assertNotNull(error);
  }
  if (DebugFlags.SSL_ERROR_HANDLER) {
    Log.v(LOGTAG,"String_Node_Str" + "String_Node_Str" + proceed + "String_Node_Str"+ loader.url());
  }
  if (!loader.cancelled()) {
    if (proceed) {
      int primary=error.getPrimaryError();
      String host=loader.host();
      if (DebugFlags.SSL_ERROR_HANDLER) {
        Assert.assertTrue(host != null && primary != 0);
      }
      boolean hasKey=mSslPrefTable.containsKey(host);
      if (!hasKey || primary > mSslPrefTable.getInt(host)) {
        mSslPrefTable.putInt(host,primary);
      }
    }
    loader.handleSslErrorResponse(proceed);
  }
}
Program: 183335
Project: 183335
Buggy source:
/** 
 * Restores this handler's state from a map.
 * @return True iff succeeds.
 */
boolean restoreState(Bundle inState){
  boolean success=(inState != null);
  if (success) {
    success=inState.containsKey("String_Node_Str");
    if (success) {
      mSslPrefTable=inState.getBundle("String_Node_Str");
    }
  }
  return success;
}

Fixed version (ground truth):
/** 
 * Restores this handler's state from a map.
 * @return True iff succeeds.
 */
synchronized boolean restoreState(Bundle inState){
  boolean success=(inState != null);
  if (success) {
    success=inState.containsKey("String_Node_Str");
    if (success) {
      mSslPrefTable=inState.getBundle("String_Node_Str");
    }
  }
  return success;
}
Program: 183336
Project: 183336
Buggy source:
/** 
 * Proceed with the SSL certificate.
 */
public void proceed(){
  sendMessage(obtainMessage(HANDLE_RESPONSE,1,0));
}

Fixed version (ground truth):
/** 
 * Proceed with the SSL certificate.
 */
public void proceed(){
  sendMessage(obtainMessage(HANDLE_RESPONSE,1,0,mLoaderQueue.poll()));
}
Program: 183337
Project: 183337
Buggy source:
/** 
 * Saves this handler's state into a map.
 * @return True iff succeeds.
 */
boolean saveState(Bundle outState){
  boolean success=(outState != null);
  if (success) {
    outState.putBundle("String_Node_Str",mSslPrefTable);
  }
  return success;
}

Fixed version (ground truth):
/** 
 * Saves this handler's state into a map.
 * @return True iff succeeds.
 */
synchronized boolean saveState(Bundle outState){
  boolean success=(outState != null);
  if (success) {
    outState.putBundle("String_Node_Str",mSslPrefTable);
  }
  return success;
}
Program: 183338
Project: 183338
Buggy source:
/** 
 * Processes the next loader in the queue.
 * @return True iff should proceed to processing thefollowing loader in the queue
 */
private synchronized boolean processNextLoader(){
  LoadListener loader=mLoaderQueue.peek();
  if (loader != null) {
    if (loader.cancelled()) {
      return true;
    }
    SslError error=loader.sslError();
    if (DebugFlags.SSL_ERROR_HANDLER) {
      Assert.assertNotNull(error);
    }
    int primary=error.getPrimaryError();
    String host=loader.host();
    if (DebugFlags.SSL_ERROR_HANDLER) {
      Assert.assertTrue(host != null && primary != 0);
    }
    if (mSslPrefTable.containsKey(host)) {
      if (primary <= mSslPrefTable.getInt(host)) {
        handleSslErrorResponse(true);
        return true;
      }
    }
    CallbackProxy proxy=loader.getFrame().getCallbackProxy();
    proxy.onReceivedSslError(this,error);
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Processes the next loader in the queue.
 * @return True iff should proceed to processing thefollowing loader in the queue
 */
private synchronized boolean processNextLoader(){
  LoadListener loader=mLoaderQueue.peek();
  if (loader != null) {
    if (loader.cancelled()) {
      mLoaderQueue.remove(loader);
      return true;
    }
    SslError error=loader.sslError();
    if (DebugFlags.SSL_ERROR_HANDLER) {
      Assert.assertNotNull(error);
    }
    if (checkSslPrefTable(loader,error)) {
      mLoaderQueue.remove(loader);
      return true;
    }
    CallbackProxy proxy=loader.getFrame().getCallbackProxy();
    proxy.onReceivedSslError(this,error);
  }
  return false;
}
Program: 183339
Project: 183339
Buggy source:
@Override public void handleMessage(Message msg){
switch (msg.what) {
case HANDLE_RESPONSE:
    handleSslErrorResponse(msg.arg1 == 1);
  fastProcessQueuedSslErrors();
break;
}
}

Fixed version (ground truth):
@Override public void handleMessage(Message msg){
switch (msg.what) {
case HANDLE_RESPONSE:
    LoadListener loader=(LoadListener)msg.obj;
  handleSslErrorResponse(loader,loader.sslError(),msg.arg1 == 1);
fastProcessQueuedSslErrors();
break;
}
}
Program: 183340
Project: 183340
Buggy source:
@Override public EGLConfig chooseConfig(EGL10 egl,EGLDisplay display,EGLConfig[] configs){
  EGLConfig closestConfig=null;
  int closestDistance=1000;
  for (  EGLConfig config : configs) {
    int r=findConfigAttrib(egl,display,config,EGL10.EGL_RED_SIZE,0);
    int g=findConfigAttrib(egl,display,config,EGL10.EGL_GREEN_SIZE,0);
    int b=findConfigAttrib(egl,display,config,EGL10.EGL_BLUE_SIZE,0);
    int a=findConfigAttrib(egl,display,config,EGL10.EGL_ALPHA_SIZE,0);
    int d=findConfigAttrib(egl,display,config,EGL10.EGL_DEPTH_SIZE,0);
    int s=findConfigAttrib(egl,display,config,EGL10.EGL_STENCIL_SIZE,0);
    int distance=Math.abs(r - mRedSize) + Math.abs(g - mGreenSize) + Math.abs(b - mBlueSize)+ Math.abs(a - mAlphaSize)+ Math.abs(d - mDepthSize)+ Math.abs(s - mStencilSize);
    if (distance < closestDistance) {
      closestDistance=distance;
      closestConfig=config;
    }
  }
  return closestConfig;
}

Fixed version (ground truth):
@Override public EGLConfig chooseConfig(EGL10 egl,EGLDisplay display,EGLConfig[] configs){
  EGLConfig closestConfig=null;
  int closestDistance=1000;
  for (  EGLConfig config : configs) {
    int d=findConfigAttrib(egl,display,config,EGL10.EGL_DEPTH_SIZE,0);
    int s=findConfigAttrib(egl,display,config,EGL10.EGL_STENCIL_SIZE,0);
    if (d >= mDepthSize && s >= mStencilSize) {
      int r=findConfigAttrib(egl,display,config,EGL10.EGL_RED_SIZE,0);
      int g=findConfigAttrib(egl,display,config,EGL10.EGL_GREEN_SIZE,0);
      int b=findConfigAttrib(egl,display,config,EGL10.EGL_BLUE_SIZE,0);
      int a=findConfigAttrib(egl,display,config,EGL10.EGL_ALPHA_SIZE,0);
      int distance=Math.abs(r - mRedSize) + Math.abs(g - mGreenSize) + Math.abs(b - mBlueSize)+ Math.abs(a - mAlphaSize);
      if (distance < closestDistance) {
        closestDistance=distance;
        closestConfig=config;
      }
    }
  }
  return closestConfig;
}
Program: 183342
Project: 183342
Buggy source:
/** 
 * This function handles the plus code conversion within NANP CDMA network If the number format is 1)+NANP or +1NANP,remove +, 2)+non-NANP Numbers,replace + with the current IDP
 */
private static String processPlusCodeWithinNanp(String networkDialStr){
  String retStr=networkDialStr;
  if (DBG)   log("String_Node_Str" + networkDialStr);
  if (networkDialStr != null & networkDialStr.charAt(0) == PLUS_SIGN_CHAR && networkDialStr.length() > 1) {
    String newStr=networkDialStr.substring(1);
    if (isNanp(newStr) || isOneNanp(newStr)) {
      retStr=newStr;
    }
 else {
      String idpStr=getDefaultIdp();
      retStr=networkDialStr.replaceFirst("String_Node_Str",idpStr);
    }
  }
  if (DBG)   log("String_Node_Str" + retStr);
  return retStr;
}

Fixed version (ground truth):
/** 
 * This function handles the plus code conversion within NANP CDMA network If the number format is 1)+1NANP,remove +, 2)other than +1NANP, any + numbers,replace + with the current IDP
 */
private static String processPlusCodeWithinNanp(String networkDialStr){
  String retStr=networkDialStr;
  if (DBG)   log("String_Node_Str" + networkDialStr);
  if (networkDialStr != null & networkDialStr.charAt(0) == PLUS_SIGN_CHAR && networkDialStr.length() > 1) {
    String newStr=networkDialStr.substring(1);
    if (isOneNanp(newStr)) {
      retStr=newStr;
    }
 else {
      String idpStr=getDefaultIdp();
      retStr=networkDialStr.replaceFirst("String_Node_Str",idpStr);
    }
  }
  if (DBG)   log("String_Node_Str" + retStr);
  return retStr;
}
Program: 183343
Project: 183343
Buggy source:
/** 
 * Returns the phone number formatting type for the given locale.
 * @param locale The locale of interest, usually {@link Locale#getDefault()}
 * @return the formatting type for the given locale, or FORMAT_UNKNOWN if the formattingrules are not known for the given locale
 */
public static int getFormatTypeForLocale(Locale locale){
  String country=locale.getCountry();
  int length=NANP_COUNTRIES.length;
  for (int i=0; i < length; i++) {
    if (NANP_COUNTRIES[i].equals(country)) {
      return FORMAT_NANP;
    }
  }
  if (locale.equals(Locale.JAPAN)) {
    return FORMAT_JAPAN;
  }
  return FORMAT_UNKNOWN;
}

Fixed version (ground truth):
/** 
 * Returns the phone number formatting type for the given locale.
 * @param locale The locale of interest, usually {@link Locale#getDefault()}
 * @return the formatting type for the given locale, or FORMAT_UNKNOWN if the formattingrules are not known for the given locale
 */
public static int getFormatTypeForLocale(Locale locale){
  String country=locale.getCountry();
  return getFormatTypeFromCountryCode(country);
}
Program: 183345
Project: 183345
Buggy source:
@SmallTest public void testCheckAndProcessPlusCodeByNumberFormat(){
  assertEquals("String_Node_Str",PhoneNumberUtils.cdmaCheckAndProcessPlusCodeByNumberFormat("String_Node_Str",PhoneNumberUtils.FORMAT_JAPAN));
  assertEquals("String_Node_Str",PhoneNumberUtils.cdmaCheckAndProcessPlusCodeByNumberFormat("String_Node_Str",PhoneNumberUtils.FORMAT_JAPAN));
  assertEquals("String_Node_Str",PhoneNumberUtils.cdmaCheckAndProcessPlusCodeByNumberFormat("String_Node_Str",PhoneNumberUtils.FORMAT_UNKNOWN));
  assertEquals("String_Node_Str",PhoneNumberUtils.cdmaCheckAndProcessPlusCodeByNumberFormat("String_Node_Str",PhoneNumberUtils.FORMAT_UNKNOWN));
}

Fixed version (ground truth):
@SmallTest public void testCheckAndProcessPlusCodeByNumberFormat(){
  assertEquals("String_Node_Str",PhoneNumberUtils.cdmaCheckAndProcessPlusCodeByNumberFormat("String_Node_Str",PhoneNumberUtils.FORMAT_NANP,PhoneNumberUtils.FORMAT_NANP));
  assertEquals("String_Node_Str",PhoneNumberUtils.cdmaCheckAndProcessPlusCodeByNumberFormat("String_Node_Str",PhoneNumberUtils.FORMAT_NANP,PhoneNumberUtils.FORMAT_JAPAN));
  assertEquals("String_Node_Str",PhoneNumberUtils.cdmaCheckAndProcessPlusCodeByNumberFormat("String_Node_Str",PhoneNumberUtils.FORMAT_NANP,PhoneNumberUtils.FORMAT_UNKNOWN));
  assertEquals("String_Node_Str",PhoneNumberUtils.cdmaCheckAndProcessPlusCodeByNumberFormat("String_Node_Str",PhoneNumberUtils.FORMAT_JAPAN,PhoneNumberUtils.FORMAT_JAPAN));
  assertEquals("String_Node_Str",PhoneNumberUtils.cdmaCheckAndProcessPlusCodeByNumberFormat("String_Node_Str",PhoneNumberUtils.FORMAT_UNKNOWN,PhoneNumberUtils.FORMAT_UNKNOWN));
}
Program: 183346
Project: 183346
Buggy source:
/** 
 * Ensure that a network route exists to deliver traffic to the specified host via the mobile data network.
 * @param hostAddress the IP address of the host to which the route is desired,in network byte order.
 * @return {@code true} on success, {@code false} on failure
 */
@Override public boolean requestRouteToHost(int hostAddress){
  if (mInterfaceName != null && hostAddress != -1) {
    if (DBG) {
      Log.d(TAG,"String_Node_Str" + Integer.toHexString(hostAddress));
    }
    return NetworkUtils.addHostRoute(mInterfaceName,hostAddress) == 0;
  }
 else {
    return false;
  }
}

Fixed version (ground truth):
/** 
 * Ensure that a network route exists to deliver traffic to the specified host via the mobile data network.
 * @param hostAddress the IP address of the host to which the route is desired,in network byte order.
 * @return {@code true} on success, {@code false} on failure
 */
@Override public boolean requestRouteToHost(int hostAddress){
  if (DBG) {
    Log.d(TAG,"String_Node_Str" + Integer.toHexString(hostAddress) + "String_Node_Str"+ mApnType+ "String_Node_Str"+ mInterfaceName+ "String_Node_Str");
  }
  if (mInterfaceName != null && hostAddress != -1) {
    return NetworkUtils.addHostRoute(mInterfaceName,hostAddress) == 0;
  }
 else {
    return false;
  }
}
Program: 183348
Project: 183348
Buggy source:
/** 
 * Re-enable mobile data connectivity after a   {@link #teardown()}.
 */
public boolean reconnect(){
  setTeardownRequested(false);
switch (setEnableApn(mApnType,true)) {
case Phone.APN_ALREADY_ACTIVE:
    mEnabled=true;
  Intent intent=new Intent(TelephonyIntents.ACTION_ANY_DATA_CONNECTION_STATE_CHANGED);
intent.putExtra(Phone.STATE_KEY,Phone.DataState.CONNECTED.toString());
intent.putExtra(Phone.STATE_CHANGE_REASON_KEY,Phone.REASON_APN_CHANGED);
intent.putExtra(Phone.DATA_APN_TYPES_KEY,mApnType);
intent.putExtra(Phone.DATA_IFACE_NAME_KEY,mInterfaceName);
intent.putExtra(Phone.NETWORK_UNAVAILABLE_KEY,false);
if (mStateReceiver != null) mStateReceiver.onReceive(mContext,intent);
break;
case Phone.APN_REQUEST_STARTED:
mEnabled=true;
break;
case Phone.APN_REQUEST_FAILED:
if (mPhoneService == null && mApnType == Phone.APN_TYPE_DEFAULT) {
return false;
}
case Phone.APN_TYPE_NOT_AVAILABLE:
mEnabled=false;
break;
default :
Log.e(TAG,"String_Node_Str");
mEnabled=false;
break;
}
return mEnabled;
}

Fixed version (ground truth):
/** 
 * Re-enable mobile data connectivity after a   {@link #teardown()}.
 */
public boolean reconnect(){
  setTeardownRequested(false);
switch (setEnableApn(mApnType,true)) {
case Phone.APN_ALREADY_ACTIVE:
    mEnabled=true;
  mMobileDataState=Phone.DataState.CONNECTING;
Intent intent=new Intent(TelephonyIntents.ACTION_ANY_DATA_CONNECTION_STATE_CHANGED);
intent.putExtra(Phone.STATE_KEY,Phone.DataState.CONNECTED.toString());
intent.putExtra(Phone.STATE_CHANGE_REASON_KEY,Phone.REASON_APN_CHANGED);
intent.putExtra(Phone.DATA_APN_TYPES_KEY,mApnType);
intent.putExtra(Phone.DATA_IFACE_NAME_KEY,mInterfaceName);
intent.putExtra(Phone.NETWORK_UNAVAILABLE_KEY,false);
if (mStateReceiver != null) mStateReceiver.onReceive(mContext,intent);
break;
case Phone.APN_REQUEST_STARTED:
mEnabled=true;
break;
case Phone.APN_REQUEST_FAILED:
if (mPhoneService == null && mApnType == Phone.APN_TYPE_DEFAULT) {
return false;
}
case Phone.APN_TYPE_NOT_AVAILABLE:
mEnabled=false;
break;
default :
Log.e(TAG,"String_Node_Str");
mEnabled=false;
break;
}
return mEnabled;
}
Program: 183349
Project: 183349
Buggy source:
private int getNumConnectedNetworks(){
  int numConnectedNets=0;
  for (  NetworkStateTracker nt : mNetTrackers) {
    if (nt.getNetworkInfo().isConnected() && !nt.isTeardownRequested()) {
      ++numConnectedNets;
    }
  }
  return numConnectedNets;
}

Fixed version (ground truth):
private int getNumConnectedNetworks(){
  int numConnectedNets=0;
  for (  NetworkStateTracker nt : mNetTrackers) {
    if (nt.getNetworkInfo().isConnected() && !nt.isTeardownRequested()) {
      ++numConnectedNets;
    }
  }
  if (DBG)   Log.d(TAG,"String_Node_Str" + numConnectedNets);
  return numConnectedNets;
}
Program: 183352
Project: 183352
Buggy source:
protected synchronized void setEnabled(int id,boolean enable){
  if (DBG)   Log.d(LOG_TAG,"String_Node_Str" + id + "String_Node_Str"+ enable+ ')');
  if (dataEnabled[id] != enable) {
    dataEnabled[id]=enable;
    if (enable) {
      enabledCount++;
    }
 else {
      enabledCount--;
    }
    if (enabledCount == 0) {
      setPrivateDataEnabled(false);
    }
 else     if (enabledCount == 1) {
      setPrivateDataEnabled(true);
    }
  }
}

Fixed version (ground truth):
protected synchronized void setEnabled(int id,boolean enable){
  if (DBG)   Log.d(LOG_TAG,"String_Node_Str" + id + "String_Node_Str"+ enable+ ')');
  if (dataEnabled[id] != enable) {
    dataEnabled[id]=enable;
    if (enable) {
      enabledCount++;
      if (enabledCount == 1) {
        setPrivateDataEnabled(true);
      }
    }
 else {
      enabledCount--;
      if (enabledCount == 0) {
        setPrivateDataEnabled(false);
      }
    }
  }
}
Program: 183354
Project: 183354
Buggy source:
@Override public boolean onTouchEvent(MotionEvent me){
  int pointerCount=me.getPointerCount();
  boolean result=false;
  if (pointerCount != mOldPointerCount) {
    long now=me.getEventTime();
    if (pointerCount == 1) {
      MotionEvent down=MotionEvent.obtain(now,now,MotionEvent.ACTION_DOWN,me.getX(),me.getY(),me.getMetaState());
      result=onModifiedTouchEvent(down);
      down.recycle();
    }
 else {
      MotionEvent up=MotionEvent.obtain(now,now,MotionEvent.ACTION_UP,mOldPointerX,mOldPointerY,me.getMetaState());
      result=onModifiedTouchEvent(up);
      up.recycle();
    }
  }
 else {
    if (pointerCount == 1) {
      mOldPointerX=me.getX();
      mOldPointerY=me.getY();
      result=onModifiedTouchEvent(me);
    }
 else {
      result=true;
    }
  }
  mOldPointerCount=pointerCount;
  return result;
}

Fixed version (ground truth):
@Override public boolean onTouchEvent(MotionEvent me){
  int pointerCount=me.getPointerCount();
  boolean result=false;
  if (pointerCount != mOldPointerCount) {
    long now=me.getEventTime();
    if (pointerCount == 1) {
      MotionEvent down=MotionEvent.obtain(now,now,MotionEvent.ACTION_DOWN,me.getX(),me.getY(),me.getMetaState());
      result=onModifiedTouchEvent(down);
      down.recycle();
      if (me.getAction() == MotionEvent.ACTION_UP) {
        result=onModifiedTouchEvent(me);
      }
    }
 else {
      MotionEvent up=MotionEvent.obtain(now,now,MotionEvent.ACTION_UP,mOldPointerX,mOldPointerY,me.getMetaState());
      result=onModifiedTouchEvent(up);
      up.recycle();
    }
  }
 else {
    if (pointerCount == 1) {
      mOldPointerX=me.getX();
      mOldPointerY=me.getY();
      result=onModifiedTouchEvent(me);
    }
 else {
      result=true;
    }
  }
  mOldPointerCount=pointerCount;
  return result;
}
Program: 183356
Project: 183356
Buggy source:
public void runTest(TestResult testResult){
  mTestResult=testResult;
  for (  TestListener testListener : mTestListeners) {
    mTestResult.addListener(testListener);
  }
  Context testContext=mInstrumentation.getContext();
  for (  TestCase testCase : mTestCases) {
    setContextIfAndroidTestCase(testCase,mContext,testContext);
    setInstrumentationIfInstrumentationTestCase(testCase,mInstrumentation);
    testCase.run(mTestResult);
  }
}

Fixed version (ground truth):
public void runTest(TestResult testResult){
  mTestResult=testResult;
  for (  TestListener testListener : mTestListeners) {
    mTestResult.addListener(testListener);
  }
  Context testContext=mInstrumentation == null ? mContext : mInstrumentation.getContext();
  for (  TestCase testCase : mTestCases) {
    setContextIfAndroidTestCase(testCase,mContext,testContext);
    setInstrumentationIfInstrumentationTestCase(testCase,mInstrumentation);
    testCase.run(mTestResult);
  }
}
Program: 183358
Project: 183358
Buggy source:
public void onSensorChanged(SensorEvent event){
  long milliseconds=event.timestamp / 1000000;
  if (event.values[0] == 0.0) {
    goToSleep(milliseconds);
  }
 else {
    userActivity(milliseconds,false);
  }
}

Fixed version (ground truth):
public void onSensorChanged(SensorEvent event){
  long milliseconds=event.timestamp / 1000000;
  if (event.values[0] == 0.0) {
    goToSleep(milliseconds);
  }
 else {
synchronized (mLocks) {
      boolean savedActivityAllowed=mUserActivityAllowed;
      mUserActivityAllowed=true;
      userActivity(milliseconds,false);
      mUserActivityAllowed=savedActivityAllowed;
    }
  }
}