nus-yam/ex-repair huggingface dataset:
Program: 2303
Project: 2303
Buggy source:
@Override public void addTestProvider(String name,ProviderProperties properties){
  checkMockPermissionsSafe();
  if (LocationManager.PASSIVE_PROVIDER.equals(name)) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  long identity=Binder.clearCallingIdentity();
synchronized (mLock) {
    MockProvider provider=new MockProvider(name,this,properties);
    if (LocationManager.GPS_PROVIDER.equals(name) || LocationManager.NETWORK_PROVIDER.equals(name) || LocationManager.FUSED_PROVIDER.equals(name)) {
      LocationProviderInterface p=mProvidersByName.get(name);
      if (p != null) {
        removeProviderLocked(p);
      }
    }
    if (mProvidersByName.get(name) != null) {
      throw new IllegalArgumentException("String_Node_Str" + name + "String_Node_Str");
    }
    addProviderLocked(provider);
    mMockProviders.put(name,provider);
    mLastLocation.put(name,null);
    updateProvidersLocked();
  }
  Binder.restoreCallingIdentity(identity);
}

Fixed version (ground truth):
@Override public void addTestProvider(String name,ProviderProperties properties){
  checkMockPermissionsSafe();
  if (LocationManager.PASSIVE_PROVIDER.equals(name)) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  long identity=Binder.clearCallingIdentity();
synchronized (mLock) {
    MockProvider provider=new MockProvider(name,this,properties);
    if (LocationManager.GPS_PROVIDER.equals(name) || LocationManager.NETWORK_PROVIDER.equals(name) || LocationManager.FUSED_PROVIDER.equals(name)) {
      LocationProviderInterface p=mProvidersByName.get(name);
      if (p != null) {
        removeProviderLocked(p);
      }
    }
    if (mProvidersByName.get(name) != null) {
      throw new IllegalArgumentException("String_Node_Str" + name + "String_Node_Str");
    }
    addProviderLocked(provider);
    mMockProviders.put(name,provider);
    mLastLocation.put(name,null);
    mLastLocationCoarseInterval.put(name,null);
    updateProvidersLocked();
  }
  Binder.restoreCallingIdentity(identity);
}
Program: 2305
Project: 2305
Buggy source:
/** 
 * Called when the device's active user changes.
 * @param userId the new active user's UserId
 */
private void switchUser(int userId){
  mBlacklist.switchUser(userId);
  mLocationHandler.removeMessages(MSG_LOCATION_CHANGED);
synchronized (mLock) {
    mLastLocation.clear();
    for (    LocationProviderInterface p : mProviders) {
      updateProviderListenersLocked(p.getName(),false,mCurrentUserId);
    }
    mCurrentUserId=userId;
    updateProvidersLocked();
  }
}

Fixed version (ground truth):
/** 
 * Called when the device's active user changes.
 * @param userId the new active user's UserId
 */
private void switchUser(int userId){
  mBlacklist.switchUser(userId);
  mLocationHandler.removeMessages(MSG_LOCATION_CHANGED);
synchronized (mLock) {
    mLastLocation.clear();
    mLastLocationCoarseInterval.clear();
    for (    LocationProviderInterface p : mProviders) {
      updateProviderListenersLocked(p.getName(),false,mCurrentUserId);
    }
    mCurrentUserId=userId;
    updateProvidersLocked();
  }
}
Program: 2308
Project: 2308
Buggy source:
@Override public void removeTestProvider(String provider){
  checkMockPermissionsSafe();
synchronized (mLock) {
    MockProvider mockProvider=mMockProviders.remove(provider);
    if (mockProvider == null) {
      throw new IllegalArgumentException("String_Node_Str" + provider + "String_Node_Str");
    }
    long identity=Binder.clearCallingIdentity();
    removeProviderLocked(mProvidersByName.get(provider));
    LocationProviderInterface realProvider=mRealProviders.get(provider);
    if (realProvider != null) {
      addProviderLocked(realProvider);
    }
    mLastLocation.put(provider,null);
    updateProvidersLocked();
    Binder.restoreCallingIdentity(identity);
  }
}

Fixed version (ground truth):
@Override public void removeTestProvider(String provider){
  checkMockPermissionsSafe();
synchronized (mLock) {
    MockProvider mockProvider=mMockProviders.remove(provider);
    if (mockProvider == null) {
      throw new IllegalArgumentException("String_Node_Str" + provider + "String_Node_Str");
    }
    long identity=Binder.clearCallingIdentity();
    removeProviderLocked(mProvidersByName.get(provider));
    LocationProviderInterface realProvider=mRealProviders.get(provider);
    if (realProvider != null) {
      addProviderLocked(realProvider);
    }
    mLastLocation.put(provider,null);
    mLastLocationCoarseInterval.put(provider,null);
    updateProvidersLocked();
    Binder.restoreCallingIdentity(identity);
  }
}
Program: 2309
Project: 2309
Buggy source:
private static boolean shouldBroadcastSafe(Location loc,Location lastLoc,UpdateRecord record,long now){
  if (lastLoc == null) {
    return true;
  }
  long minTime=record.mRequest.getFastestInterval();
  long delta=(loc.getElapsedRealtimeNanos() - lastLoc.getElapsedRealtimeNanos()) / 1000000L;
  if (delta < minTime - MAX_PROVIDER_SCHEDULING_JITTER_MS) {
    return false;
  }
  double minDistance=record.mRequest.getSmallestDisplacement();
  if (minDistance > 0.0) {
    if (loc.distanceTo(lastLoc) <= minDistance) {
      return false;
    }
  }
  if (record.mRequest.getNumUpdates() <= 0) {
    return false;
  }
  if (record.mRequest.getExpireAt() < now) {
    return false;
  }
  return true;
}

Fixed version (ground truth):
private static boolean shouldBroadcastSafe(Location loc,Location lastLoc,UpdateRecord record,long now){
  if (lastLoc == null) {
    return true;
  }
  long minTime=record.mRequest.getFastestInterval();
  long delta=(loc.getElapsedRealtimeNanos() - lastLoc.getElapsedRealtimeNanos()) / NANOS_PER_MILLI;
  if (delta < minTime - MAX_PROVIDER_SCHEDULING_JITTER_MS) {
    return false;
  }
  double minDistance=record.mRequest.getSmallestDisplacement();
  if (minDistance > 0.0) {
    if (loc.distanceTo(lastLoc) <= minDistance) {
      return false;
    }
  }
  if (record.mRequest.getNumUpdates() <= 0) {
    return false;
  }
  if (record.mRequest.getExpireAt() < now) {
    return false;
  }
  return true;
}
Program: 2311
Project: 2311
Buggy source:
/** 
 * Return whether this window is wanting to have a translation animation applied to it for an in-progress move.  (Only makes sense to call from performLayoutAndPlaceSurfacesLockedInner().)
 */
boolean shouldAnimateMove(){
  return mContentChanged && !mExiting && !mWinAnimator.mLastHidden&& mService.okToDisplay()&& (mFrame.top != mLastFrame.top || mFrame.left != mLastFrame.left)&& (mAttachedWindow == null || !mAttachedWindow.shouldAnimateMove());
}

Fixed version (ground truth):
/** 
 * Return whether this window is wanting to have a translation animation applied to it for an in-progress move.  (Only makes sense to call from performLayoutAndPlaceSurfacesLockedInner().)
 */
boolean shouldAnimateMove(){
  return mContentChanged && !mExiting && !mWinAnimator.mLastHidden&& mService.okToDisplay()&& (mFrame.top != mLastFrame.top || mFrame.left != mLastFrame.left)&& (mAttrs.privateFlags & PRIVATE_FLAG_NO_MOVE_ANIMATION) == 0 && (mAttachedWindow == null || !mAttachedWindow.shouldAnimateMove());
}
Program: 2312
Project: 2312
Buggy source:
@Override public void addTestProvider(String name,ProviderProperties properties){
  checkMockPermissionsSafe();
  if (LocationManager.PASSIVE_PROVIDER.equals(name)) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  long identity=Binder.clearCallingIdentity();
synchronized (mLock) {
    MockProvider provider=new MockProvider(name,this,properties);
    if (LocationManager.GPS_PROVIDER.equals(name) || LocationManager.NETWORK_PROVIDER.equals(name) || LocationManager.FUSED_PROVIDER.equals(name)) {
      LocationProviderInterface p=mProvidersByName.get(name);
      if (p != null) {
        removeProviderLocked(p);
      }
    }
    if (mProvidersByName.get(name) != null) {
      throw new IllegalArgumentException("String_Node_Str" + name + "String_Node_Str");
    }
    addProviderLocked(provider);
    mMockProviders.put(name,provider);
    mLastLocation.put(name,null);
    updateProvidersLocked();
  }
  Binder.restoreCallingIdentity(identity);
}

Fixed version (ground truth):
@Override public void addTestProvider(String name,ProviderProperties properties){
  checkMockPermissionsSafe();
  if (LocationManager.PASSIVE_PROVIDER.equals(name)) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  long identity=Binder.clearCallingIdentity();
synchronized (mLock) {
    MockProvider provider=new MockProvider(name,this,properties);
    if (LocationManager.GPS_PROVIDER.equals(name) || LocationManager.NETWORK_PROVIDER.equals(name) || LocationManager.FUSED_PROVIDER.equals(name)) {
      LocationProviderInterface p=mProvidersByName.get(name);
      if (p != null) {
        removeProviderLocked(p);
      }
    }
    if (mProvidersByName.get(name) != null) {
      throw new IllegalArgumentException("String_Node_Str" + name + "String_Node_Str");
    }
    addProviderLocked(provider);
    mMockProviders.put(name,provider);
    mLastLocation.put(name,null);
    mLastLocationCoarseInterval.put(name,null);
    updateProvidersLocked();
  }
  Binder.restoreCallingIdentity(identity);
}
Program: 2314
Project: 2314
Buggy source:
/** 
 * Called when the device's active user changes.
 * @param userId the new active user's UserId
 */
private void switchUser(int userId){
  mBlacklist.switchUser(userId);
  mLocationHandler.removeMessages(MSG_LOCATION_CHANGED);
synchronized (mLock) {
    mLastLocation.clear();
    for (    LocationProviderInterface p : mProviders) {
      updateProviderListenersLocked(p.getName(),false,mCurrentUserId);
    }
    mCurrentUserId=userId;
    updateProvidersLocked();
  }
}

Fixed version (ground truth):
/** 
 * Called when the device's active user changes.
 * @param userId the new active user's UserId
 */
private void switchUser(int userId){
  mBlacklist.switchUser(userId);
  mLocationHandler.removeMessages(MSG_LOCATION_CHANGED);
synchronized (mLock) {
    mLastLocation.clear();
    mLastLocationCoarseInterval.clear();
    for (    LocationProviderInterface p : mProviders) {
      updateProviderListenersLocked(p.getName(),false,mCurrentUserId);
    }
    mCurrentUserId=userId;
    updateProvidersLocked();
  }
}
Program: 2317
Project: 2317
Buggy source:
@Override public void removeTestProvider(String provider){
  checkMockPermissionsSafe();
synchronized (mLock) {
    MockProvider mockProvider=mMockProviders.remove(provider);
    if (mockProvider == null) {
      throw new IllegalArgumentException("String_Node_Str" + provider + "String_Node_Str");
    }
    long identity=Binder.clearCallingIdentity();
    removeProviderLocked(mProvidersByName.get(provider));
    LocationProviderInterface realProvider=mRealProviders.get(provider);
    if (realProvider != null) {
      addProviderLocked(realProvider);
    }
    mLastLocation.put(provider,null);
    updateProvidersLocked();
    Binder.restoreCallingIdentity(identity);
  }
}

Fixed version (ground truth):
@Override public void removeTestProvider(String provider){
  checkMockPermissionsSafe();
synchronized (mLock) {
    MockProvider mockProvider=mMockProviders.remove(provider);
    if (mockProvider == null) {
      throw new IllegalArgumentException("String_Node_Str" + provider + "String_Node_Str");
    }
    long identity=Binder.clearCallingIdentity();
    removeProviderLocked(mProvidersByName.get(provider));
    LocationProviderInterface realProvider=mRealProviders.get(provider);
    if (realProvider != null) {
      addProviderLocked(realProvider);
    }
    mLastLocation.put(provider,null);
    mLastLocationCoarseInterval.put(provider,null);
    updateProvidersLocked();
    Binder.restoreCallingIdentity(identity);
  }
}
Program: 2318
Project: 2318
Buggy source:
private static boolean shouldBroadcastSafe(Location loc,Location lastLoc,UpdateRecord record,long now){
  if (lastLoc == null) {
    return true;
  }
  long minTime=record.mRequest.getFastestInterval();
  long delta=(loc.getElapsedRealtimeNanos() - lastLoc.getElapsedRealtimeNanos()) / 1000000L;
  if (delta < minTime - MAX_PROVIDER_SCHEDULING_JITTER_MS) {
    return false;
  }
  double minDistance=record.mRequest.getSmallestDisplacement();
  if (minDistance > 0.0) {
    if (loc.distanceTo(lastLoc) <= minDistance) {
      return false;
    }
  }
  if (record.mRequest.getNumUpdates() <= 0) {
    return false;
  }
  if (record.mRequest.getExpireAt() < now) {
    return false;
  }
  return true;
}

Fixed version (ground truth):
private static boolean shouldBroadcastSafe(Location loc,Location lastLoc,UpdateRecord record,long now){
  if (lastLoc == null) {
    return true;
  }
  long minTime=record.mRequest.getFastestInterval();
  long delta=(loc.getElapsedRealtimeNanos() - lastLoc.getElapsedRealtimeNanos()) / NANOS_PER_MILLI;
  if (delta < minTime - MAX_PROVIDER_SCHEDULING_JITTER_MS) {
    return false;
  }
  double minDistance=record.mRequest.getSmallestDisplacement();
  if (minDistance > 0.0) {
    if (loc.distanceTo(lastLoc) <= minDistance) {
      return false;
    }
  }
  if (record.mRequest.getNumUpdates() <= 0) {
    return false;
  }
  if (record.mRequest.getExpireAt() < now) {
    return false;
  }
  return true;
}
Program: 2320
Project: 2320
Buggy source:
/** 
 * Return whether this window is wanting to have a translation animation applied to it for an in-progress move.  (Only makes sense to call from performLayoutAndPlaceSurfacesLockedInner().)
 */
boolean shouldAnimateMove(){
  return mContentChanged && !mExiting && !mWinAnimator.mLastHidden&& mService.okToDisplay()&& (mFrame.top != mLastFrame.top || mFrame.left != mLastFrame.left)&& (mAttachedWindow == null || !mAttachedWindow.shouldAnimateMove());
}

Fixed version (ground truth):
/** 
 * Return whether this window is wanting to have a translation animation applied to it for an in-progress move.  (Only makes sense to call from performLayoutAndPlaceSurfacesLockedInner().)
 */
boolean shouldAnimateMove(){
  return mContentChanged && !mExiting && !mWinAnimator.mLastHidden&& mService.okToDisplay()&& (mFrame.top != mLastFrame.top || mFrame.left != mLastFrame.left)&& (mAttrs.privateFlags & PRIVATE_FLAG_NO_MOVE_ANIMATION) == 0 && (mAttachedWindow == null || !mAttachedWindow.shouldAnimateMove());
}
Program: 2321
Project: 2321
Buggy source:
public boolean onJsConfirm(String url,String message){
  if (mWebChromeClient == null) {
    return false;
  }
  JsResultReceiver result=new JsResultReceiver();
  Message confirm=obtainMessage(JS_CONFIRM,result);
  confirm.getData().putString("String_Node_Str",message);
  confirm.getData().putString("String_Node_Str",url);
  sendMessageToUiThreadSync(confirm);
  return result.mJsResult.getResult();
}

Fixed version (ground truth):
public boolean onJsConfirm(String url,String message){
  if (mWebChromeClient == null) {
    return false;
  }
  JsResultReceiver result=new JsResultReceiver();
  Message confirm=obtainMessage(JS_DIALOG,result);
  confirm.getData().putString("String_Node_Str",message);
  confirm.getData().putString("String_Node_Str",url);
  confirm.getData().putInt("String_Node_Str",JsDialogHelper.CONFIRM);
  sendMessageToUiThreadSync(confirm);
  return result.mJsResult.getResult();
}
Program: 2322
Project: 2322
Buggy source:
public void onJsAlert(String url,String message){
  if (mWebChromeClient == null) {
    return;
  }
  JsResultReceiver result=new JsResultReceiver();
  Message alert=obtainMessage(JS_ALERT,result);
  alert.getData().putString("String_Node_Str",message);
  alert.getData().putString("String_Node_Str",url);
  sendMessageToUiThreadSync(alert);
}

Fixed version (ground truth):
public void onJsAlert(String url,String message){
  if (mWebChromeClient == null) {
    return;
  }
  JsResultReceiver result=new JsResultReceiver();
  Message alert=obtainMessage(JS_DIALOG,result);
  alert.getData().putString("String_Node_Str",message);
  alert.getData().putString("String_Node_Str",url);
  alert.getData().putInt("String_Node_Str",JsDialogHelper.ALERT);
  sendMessageToUiThreadSync(alert);
}
Program: 2323
Project: 2323
Buggy source:
public String onJsPrompt(String url,String message,String defaultValue){
  if (mWebChromeClient == null) {
    return null;
  }
  JsResultReceiver result=new JsResultReceiver();
  Message prompt=obtainMessage(JS_PROMPT,result);
  prompt.getData().putString("String_Node_Str",message);
  prompt.getData().putString("String_Node_Str",defaultValue);
  prompt.getData().putString("String_Node_Str",url);
  sendMessageToUiThreadSync(prompt);
  return result.mJsResult.getStringResult();
}

Fixed version (ground truth):
public String onJsPrompt(String url,String message,String defaultValue){
  if (mWebChromeClient == null) {
    return null;
  }
  JsResultReceiver result=new JsResultReceiver();
  Message prompt=obtainMessage(JS_DIALOG,result);
  prompt.getData().putString("String_Node_Str",message);
  prompt.getData().putString("String_Node_Str",defaultValue);
  prompt.getData().putString("String_Node_Str",url);
  prompt.getData().putInt("String_Node_Str",JsDialogHelper.PROMPT);
  sendMessageToUiThreadSync(prompt);
  return result.mJsResult.getStringResult();
}
Program: 2324
Project: 2324
Buggy source:
public boolean onJsBeforeUnload(String url,String message){
  if (mWebChromeClient == null) {
    return true;
  }
  JsResultReceiver result=new JsResultReceiver();
  Message confirm=obtainMessage(JS_UNLOAD,result);
  confirm.getData().putString("String_Node_Str",message);
  confirm.getData().putString("String_Node_Str",url);
  sendMessageToUiThreadSync(confirm);
  return result.mJsResult.getResult();
}

Fixed version (ground truth):
public boolean onJsBeforeUnload(String url,String message){
  if (mWebChromeClient == null) {
    return true;
  }
  JsResultReceiver result=new JsResultReceiver();
  Message unload=obtainMessage(JS_DIALOG,result);
  unload.getData().putString("String_Node_Str",message);
  unload.getData().putString("String_Node_Str",url);
  unload.getData().putInt("String_Node_Str",JsDialogHelper.UNLOAD);
  sendMessageToUiThreadSync(unload);
  return result.mJsResult.getResult();
}
Program: 2331
Project: 2331
Buggy source:
public synchronized void removeAllocSize(int bytes){
  currentSize-=bytes;
}

Fixed version (ground truth):
public synchronized void removeAllocSize(long bytes){
  currentSize-=bytes;
}
Program: 2332
Project: 2332
Buggy source:
public void run(){
  while (mRun) {
    boolean doGC=false;
synchronized (this) {
      if (currentSize >= targetSize) {
        doGC=true;
      }
    }
    if (doGC == true) {
      System.gc();
    }
    try {
      sleep(1,0);
    }
 catch (    InterruptedException e) {
    }
  }
  Log.d(LOG_TAG,"String_Node_Str");
}

Fixed version (ground truth):
public void run(){
  ActivityManager am=(ActivityManager)mRS.getApplicationContext().getSystemService(Context.ACTIVITY_SERVICE);
  ActivityManager.MemoryInfo meminfo=new ActivityManager.MemoryInfo();
  am.getMemoryInfo(meminfo);
  targetSize=(long)(meminfo.totalMem * .5f);
  while (mRun) {
    System.gc();
    lock.lock();
    try {
      cond.awaitUninterruptibly();
    }
  finally {
      lock.unlock();
    }
  }
  Log.d(LOG_TAG,"String_Node_Str");
}
Program: 2333
Project: 2333
Buggy source:
/** 
 * Destroy this renderscript context.  Once this function is called its no longer legal to use this or any objects created by this context.
 */
public void destroy(){
  validate();
  nContextDeinitToClient(mContext);
  mMessageThread.mRun=false;
  mGCThread.mRun=false;
  try {
    mMessageThread.join();
    mGCThread.join();
  }
 catch (  InterruptedException e) {
  }
  nContextDestroy();
  mContext=0;
  nDeviceDestroy(mDev);
  mDev=0;
}

Fixed version (ground truth):
/** 
 * Destroy this renderscript context.  Once this function is called its no longer legal to use this or any objects created by this context.
 */
public void destroy(){
  validate();
  nContextDeinitToClient(mContext);
  mMessageThread.mRun=false;
  mGCThread.mRun=false;
  mGCThread.addAllocSize(0);
  try {
    mMessageThread.join();
    mGCThread.join();
  }
 catch (  InterruptedException e) {
  }
  nContextDestroy();
  mContext=0;
  nDeviceDestroy(mDev);
  mDev=0;
}
Program: 2334
Project: 2334
Buggy source:
public synchronized void addAllocSize(int bytes){
  currentSize+=bytes;
}

Fixed version (ground truth):
public synchronized void addAllocSize(long bytes){
  currentSize+=bytes;
  if (currentSize >= targetSize) {
    lock.lock();
    try {
      cond.signal();
    }
  finally {
      lock.unlock();
    }
  }
}
Program: 2335
Project: 2335
Buggy source:
/** 
 * Constructs a new WebView with layout parameters, a default style and a set of custom Javscript interfaces to be added to this WebView at initialization time. This guarantees that these interfaces will be available when the JS context is initialized.
 * @param context a Context object used to access application assets
 * @param attrs an AttributeSet passed to our parent
 * @param defStyle the default style resource ID
 * @param javaScriptInterfaces a Map of interface names, as keys, andobject implementing those interfaces, as values
 * @param privateBrowsing whether this WebView will be initialized inprivate mode
 * @hide This is used internally by dumprendertree, as it requires the javaScript interfaces tobe added synchronously, before a subsequent loadUrl call takes effect.
 */
@SuppressWarnings("String_Node_Str") protected WebView(Context context,AttributeSet attrs,int defStyle,Map<String,Object> javaScriptInterfaces,boolean privateBrowsing){
  super(context,attrs,defStyle);
  if (context == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  checkThread();
  ensureProviderCreated();
  mProvider.init(javaScriptInterfaces,privateBrowsing);
}

Fixed version (ground truth):
/** 
 * Constructs a new WebView with layout parameters, a default style and a set of custom Javscript interfaces to be added to this WebView at initialization time. This guarantees that these interfaces will be available when the JS context is initialized.
 * @param context a Context object used to access application assets
 * @param attrs an AttributeSet passed to our parent
 * @param defStyle the default style resource ID
 * @param javaScriptInterfaces a Map of interface names, as keys, andobject implementing those interfaces, as values
 * @param privateBrowsing whether this WebView will be initialized inprivate mode
 * @hide This is used internally by dumprendertree, as it requires the javaScript interfaces tobe added synchronously, before a subsequent loadUrl call takes effect.
 */
@SuppressWarnings("String_Node_Str") protected WebView(Context context,AttributeSet attrs,int defStyle,Map<String,Object> javaScriptInterfaces,boolean privateBrowsing){
  super(context,attrs,defStyle);
  if (context == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  sEnforceThreadChecking=context.getApplicationInfo().targetSdkVersion >= Build.VERSION_CODES.JELLY_BEAN_MR2;
  checkThread();
  ensureProviderCreated();
  mProvider.init(javaScriptInterfaces,privateBrowsing);
}
Program: 2336
Project: 2336
Buggy source:
private static void checkThread(){
  if (Looper.myLooper() != Looper.getMainLooper()) {
    Throwable throwable=new Throwable("String_Node_Str" + Thread.currentThread().getName() + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
    Log.w(LOGTAG,Log.getStackTraceString(throwable));
    StrictMode.onWebViewMethodCalledOnWrongThread(throwable);
  }
}

Fixed version (ground truth):
private static void checkThread(){
  if (Looper.myLooper() != Looper.getMainLooper()) {
    Throwable throwable=new Throwable("String_Node_Str" + Thread.currentThread().getName() + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
    Log.w(LOGTAG,Log.getStackTraceString(throwable));
    StrictMode.onWebViewMethodCalledOnWrongThread(throwable);
    if (sEnforceThreadChecking) {
      throw new RuntimeException(throwable);
    }
  }
}
Program: 2337
Project: 2337
Buggy source:
public synchronized void removeAllocSize(int bytes){
  currentSize-=bytes;
}

Fixed version (ground truth):
public synchronized void removeAllocSize(long bytes){
  currentSize-=bytes;
}
Program: 2338
Project: 2338
Buggy source:
public void run(){
  while (mRun) {
    boolean doGC=false;
synchronized (this) {
      if (currentSize >= targetSize) {
        doGC=true;
      }
    }
    if (doGC == true) {
      System.gc();
    }
    try {
      sleep(1,0);
    }
 catch (    InterruptedException e) {
    }
  }
  Log.d(LOG_TAG,"String_Node_Str");
}

Fixed version (ground truth):
public void run(){
  ActivityManager am=(ActivityManager)mRS.getApplicationContext().getSystemService(Context.ACTIVITY_SERVICE);
  ActivityManager.MemoryInfo meminfo=new ActivityManager.MemoryInfo();
  am.getMemoryInfo(meminfo);
  targetSize=(long)(meminfo.totalMem * .5f);
  while (mRun) {
    System.gc();
    lock.lock();
    try {
      cond.awaitUninterruptibly();
    }
  finally {
      lock.unlock();
    }
  }
  Log.d(LOG_TAG,"String_Node_Str");
}
Program: 2339
Project: 2339
Buggy source:
/** 
 * Destroy this renderscript context.  Once this function is called its no longer legal to use this or any objects created by this context.
 */
public void destroy(){
  validate();
  nContextDeinitToClient(mContext);
  mMessageThread.mRun=false;
  mGCThread.mRun=false;
  try {
    mMessageThread.join();
    mGCThread.join();
  }
 catch (  InterruptedException e) {
  }
  nContextDestroy();
  mContext=0;
  nDeviceDestroy(mDev);
  mDev=0;
}

Fixed version (ground truth):
/** 
 * Destroy this renderscript context.  Once this function is called its no longer legal to use this or any objects created by this context.
 */
public void destroy(){
  validate();
  nContextDeinitToClient(mContext);
  mMessageThread.mRun=false;
  mGCThread.mRun=false;
  mGCThread.addAllocSize(0);
  try {
    mMessageThread.join();
    mGCThread.join();
  }
 catch (  InterruptedException e) {
  }
  nContextDestroy();
  mContext=0;
  nDeviceDestroy(mDev);
  mDev=0;
}
Program: 2340
Project: 2340
Buggy source:
public synchronized void addAllocSize(int bytes){
  currentSize+=bytes;
}

Fixed version (ground truth):
public synchronized void addAllocSize(long bytes){
  currentSize+=bytes;
  if (currentSize >= targetSize) {
    lock.lock();
    try {
      cond.signal();
    }
  finally {
      lock.unlock();
    }
  }
}
Program: 2341
Project: 2341
Buggy source:
/** 
 * Constructs a new WebView with layout parameters, a default style and a set of custom Javscript interfaces to be added to this WebView at initialization time. This guarantees that these interfaces will be available when the JS context is initialized.
 * @param context a Context object used to access application assets
 * @param attrs an AttributeSet passed to our parent
 * @param defStyle the default style resource ID
 * @param javaScriptInterfaces a Map of interface names, as keys, andobject implementing those interfaces, as values
 * @param privateBrowsing whether this WebView will be initialized inprivate mode
 * @hide This is used internally by dumprendertree, as it requires the javaScript interfaces tobe added synchronously, before a subsequent loadUrl call takes effect.
 */
@SuppressWarnings("String_Node_Str") protected WebView(Context context,AttributeSet attrs,int defStyle,Map<String,Object> javaScriptInterfaces,boolean privateBrowsing){
  super(context,attrs,defStyle);
  if (context == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  checkThread();
  ensureProviderCreated();
  mProvider.init(javaScriptInterfaces,privateBrowsing);
}

Fixed version (ground truth):
/** 
 * Constructs a new WebView with layout parameters, a default style and a set of custom Javscript interfaces to be added to this WebView at initialization time. This guarantees that these interfaces will be available when the JS context is initialized.
 * @param context a Context object used to access application assets
 * @param attrs an AttributeSet passed to our parent
 * @param defStyle the default style resource ID
 * @param javaScriptInterfaces a Map of interface names, as keys, andobject implementing those interfaces, as values
 * @param privateBrowsing whether this WebView will be initialized inprivate mode
 * @hide This is used internally by dumprendertree, as it requires the javaScript interfaces tobe added synchronously, before a subsequent loadUrl call takes effect.
 */
@SuppressWarnings("String_Node_Str") protected WebView(Context context,AttributeSet attrs,int defStyle,Map<String,Object> javaScriptInterfaces,boolean privateBrowsing){
  super(context,attrs,defStyle);
  if (context == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  sEnforceThreadChecking=context.getApplicationInfo().targetSdkVersion >= Build.VERSION_CODES.JELLY_BEAN_MR2;
  checkThread();
  ensureProviderCreated();
  mProvider.init(javaScriptInterfaces,privateBrowsing);
}
Program: 2342
Project: 2342
Buggy source:
private static void checkThread(){
  if (Looper.myLooper() != Looper.getMainLooper()) {
    Throwable throwable=new Throwable("String_Node_Str" + Thread.currentThread().getName() + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
    Log.w(LOGTAG,Log.getStackTraceString(throwable));
    StrictMode.onWebViewMethodCalledOnWrongThread(throwable);
  }
}

Fixed version (ground truth):
private static void checkThread(){
  if (Looper.myLooper() != Looper.getMainLooper()) {
    Throwable throwable=new Throwable("String_Node_Str" + Thread.currentThread().getName() + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
    Log.w(LOGTAG,Log.getStackTraceString(throwable));
    StrictMode.onWebViewMethodCalledOnWrongThread(throwable);
    if (sEnforceThreadChecking) {
      throw new RuntimeException(throwable);
    }
  }
}
Program: 2343
Project: 2343
Buggy source:
public synchronized void removeAllocSize(int bytes){
  currentSize-=bytes;
}

Fixed version (ground truth):
public synchronized void removeAllocSize(long bytes){
  currentSize-=bytes;
}
Program: 2344
Project: 2344
Buggy source:
public void run(){
  while (mRun) {
    boolean doGC=false;
synchronized (this) {
      if (currentSize >= targetSize) {
        doGC=true;
      }
    }
    if (doGC == true) {
      System.gc();
    }
    try {
      sleep(1,0);
    }
 catch (    InterruptedException e) {
    }
  }
  Log.d(LOG_TAG,"String_Node_Str");
}

Fixed version (ground truth):
public void run(){
  ActivityManager am=(ActivityManager)mRS.getApplicationContext().getSystemService(Context.ACTIVITY_SERVICE);
  ActivityManager.MemoryInfo meminfo=new ActivityManager.MemoryInfo();
  am.getMemoryInfo(meminfo);
  targetSize=(long)(meminfo.totalMem * .5f);
  while (mRun) {
    System.gc();
    lock.lock();
    try {
      cond.awaitUninterruptibly();
    }
  finally {
      lock.unlock();
    }
  }
  Log.d(LOG_TAG,"String_Node_Str");
}
Program: 2345
Project: 2345
Buggy source:
/** 
 * Destroy this renderscript context.  Once this function is called its no longer legal to use this or any objects created by this context.
 */
public void destroy(){
  validate();
  nContextDeinitToClient(mContext);
  mMessageThread.mRun=false;
  mGCThread.mRun=false;
  try {
    mMessageThread.join();
    mGCThread.join();
  }
 catch (  InterruptedException e) {
  }
  nContextDestroy();
  mContext=0;
  nDeviceDestroy(mDev);
  mDev=0;
}

Fixed version (ground truth):
/** 
 * Destroy this renderscript context.  Once this function is called its no longer legal to use this or any objects created by this context.
 */
public void destroy(){
  validate();
  nContextDeinitToClient(mContext);
  mMessageThread.mRun=false;
  mGCThread.mRun=false;
  mGCThread.addAllocSize(0);
  try {
    mMessageThread.join();
    mGCThread.join();
  }
 catch (  InterruptedException e) {
  }
  nContextDestroy();
  mContext=0;
  nDeviceDestroy(mDev);
  mDev=0;
}
Program: 2346
Project: 2346
Buggy source:
public synchronized void addAllocSize(int bytes){
  currentSize+=bytes;
}

Fixed version (ground truth):
public synchronized void addAllocSize(long bytes){
  currentSize+=bytes;
  if (currentSize >= targetSize) {
    lock.lock();
    try {
      cond.signal();
    }
  finally {
      lock.unlock();
    }
  }
}
Program: 2347
Project: 2347
Buggy source:
/** 
 * Constructs a new WebView with layout parameters, a default style and a set of custom Javscript interfaces to be added to this WebView at initialization time. This guarantees that these interfaces will be available when the JS context is initialized.
 * @param context a Context object used to access application assets
 * @param attrs an AttributeSet passed to our parent
 * @param defStyle the default style resource ID
 * @param javaScriptInterfaces a Map of interface names, as keys, andobject implementing those interfaces, as values
 * @param privateBrowsing whether this WebView will be initialized inprivate mode
 * @hide This is used internally by dumprendertree, as it requires the javaScript interfaces tobe added synchronously, before a subsequent loadUrl call takes effect.
 */
@SuppressWarnings("String_Node_Str") protected WebView(Context context,AttributeSet attrs,int defStyle,Map<String,Object> javaScriptInterfaces,boolean privateBrowsing){
  super(context,attrs,defStyle);
  if (context == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  checkThread();
  ensureProviderCreated();
  mProvider.init(javaScriptInterfaces,privateBrowsing);
}

Fixed version (ground truth):
/** 
 * Constructs a new WebView with layout parameters, a default style and a set of custom Javscript interfaces to be added to this WebView at initialization time. This guarantees that these interfaces will be available when the JS context is initialized.
 * @param context a Context object used to access application assets
 * @param attrs an AttributeSet passed to our parent
 * @param defStyle the default style resource ID
 * @param javaScriptInterfaces a Map of interface names, as keys, andobject implementing those interfaces, as values
 * @param privateBrowsing whether this WebView will be initialized inprivate mode
 * @hide This is used internally by dumprendertree, as it requires the javaScript interfaces tobe added synchronously, before a subsequent loadUrl call takes effect.
 */
@SuppressWarnings("String_Node_Str") protected WebView(Context context,AttributeSet attrs,int defStyle,Map<String,Object> javaScriptInterfaces,boolean privateBrowsing){
  super(context,attrs,defStyle);
  if (context == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  sEnforceThreadChecking=context.getApplicationInfo().targetSdkVersion >= Build.VERSION_CODES.JELLY_BEAN_MR2;
  checkThread();
  ensureProviderCreated();
  mProvider.init(javaScriptInterfaces,privateBrowsing);
}
Program: 2348
Project: 2348
Buggy source:
private static void checkThread(){
  if (Looper.myLooper() != Looper.getMainLooper()) {
    Throwable throwable=new Throwable("String_Node_Str" + Thread.currentThread().getName() + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
    Log.w(LOGTAG,Log.getStackTraceString(throwable));
    StrictMode.onWebViewMethodCalledOnWrongThread(throwable);
  }
}

Fixed version (ground truth):
private static void checkThread(){
  if (Looper.myLooper() != Looper.getMainLooper()) {
    Throwable throwable=new Throwable("String_Node_Str" + Thread.currentThread().getName() + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
    Log.w(LOGTAG,Log.getStackTraceString(throwable));
    StrictMode.onWebViewMethodCalledOnWrongThread(throwable);
    if (sEnforceThreadChecking) {
      throw new RuntimeException(throwable);
    }
  }
}
Program: 2349
Project: 2349
Buggy source:
public synchronized void removeAllocSize(int bytes){
  currentSize-=bytes;
}

Fixed version (ground truth):
public synchronized void removeAllocSize(long bytes){
  currentSize-=bytes;
}
Program: 2350
Project: 2350
Buggy source:
public void run(){
  while (mRun) {
    boolean doGC=false;
synchronized (this) {
      if (currentSize >= targetSize) {
        doGC=true;
      }
    }
    if (doGC == true) {
      System.gc();
    }
    try {
      sleep(1,0);
    }
 catch (    InterruptedException e) {
    }
  }
  Log.d(LOG_TAG,"String_Node_Str");
}

Fixed version (ground truth):
public void run(){
  ActivityManager am=(ActivityManager)mRS.getApplicationContext().getSystemService(Context.ACTIVITY_SERVICE);
  ActivityManager.MemoryInfo meminfo=new ActivityManager.MemoryInfo();
  am.getMemoryInfo(meminfo);
  targetSize=(long)(meminfo.totalMem * .5f);
  while (mRun) {
    System.gc();
    lock.lock();
    try {
      cond.awaitUninterruptibly();
    }
  finally {
      lock.unlock();
    }
  }
  Log.d(LOG_TAG,"String_Node_Str");
}
Program: 2351
Project: 2351
Buggy source:
/** 
 * Destroy this renderscript context.  Once this function is called its no longer legal to use this or any objects created by this context.
 */
public void destroy(){
  validate();
  nContextDeinitToClient(mContext);
  mMessageThread.mRun=false;
  mGCThread.mRun=false;
  try {
    mMessageThread.join();
    mGCThread.join();
  }
 catch (  InterruptedException e) {
  }
  nContextDestroy();
  mContext=0;
  nDeviceDestroy(mDev);
  mDev=0;
}

Fixed version (ground truth):
/** 
 * Destroy this renderscript context.  Once this function is called its no longer legal to use this or any objects created by this context.
 */
public void destroy(){
  validate();
  nContextDeinitToClient(mContext);
  mMessageThread.mRun=false;
  mGCThread.mRun=false;
  mGCThread.addAllocSize(0);
  try {
    mMessageThread.join();
    mGCThread.join();
  }
 catch (  InterruptedException e) {
  }
  nContextDestroy();
  mContext=0;
  nDeviceDestroy(mDev);
  mDev=0;
}
Program: 2352
Project: 2352
Buggy source:
public synchronized void addAllocSize(int bytes){
  currentSize+=bytes;
}

Fixed version (ground truth):
public synchronized void addAllocSize(long bytes){
  currentSize+=bytes;
  if (currentSize >= targetSize) {
    lock.lock();
    try {
      cond.signal();
    }
  finally {
      lock.unlock();
    }
  }
}
Program: 2353
Project: 2353
Buggy source:
/** 
 * Return the name of the activity that invoked this activity.  This is who the data in   {@link #setResult setResult()} will be sent to.  Youcan use this information to validate that the recipient is allowed to receive the data. <p>Note: if the calling activity is not expecting a result (that is it did not use the  {@link #startActivityForResult} form that includes a request code), then the calling package will be  null. 
 * @return String The full name of the activity that will receive yourreply, or null if none.
 */
public ComponentName getCallingActivity(){
  try {
    return ActivityManagerNative.getDefault().getCallingActivity(mToken);
  }
 catch (  RemoteException e) {
    return null;
  }
}

Fixed version (ground truth):
/** 
 * Return the name of the activity that invoked this activity.  This is who the data in   {@link #setResult setResult()} will be sent to.  Youcan use this information to validate that the recipient is allowed to receive the data. <p class="note">Note: if the calling activity is not expecting a result (that is it did not use the  {@link #startActivityForResult} form that includes a request code), then the calling package will be  null. 
 * @return The ComponentName of the activity that will receive yourreply, or null if none.
 */
public ComponentName getCallingActivity(){
  try {
    return ActivityManagerNative.getDefault().getCallingActivity(mToken);
  }
 catch (  RemoteException e) {
    return null;
  }
}
Program: 2354
Project: 2354
Buggy source:
/** 
 * Return the name of the package that invoked this activity.  This is who the data in   {@link #setResult setResult()} will be sent to.  You canuse this information to validate that the recipient is allowed to receive the data. <p>Note: if the calling activity is not expecting a result (that is it did not use the  {@link #startActivityForResult} form that includes a request code), then the calling package will be  null. 
 * @return The package of the activity that will receive yourreply, or null if none.
 */
public String getCallingPackage(){
  try {
    return ActivityManagerNative.getDefault().getCallingPackage(mToken);
  }
 catch (  RemoteException e) {
    return null;
  }
}

Fixed version (ground truth):
/** 
 * Return the name of the package that invoked this activity.  This is who the data in   {@link #setResult setResult()} will be sent to.  You canuse this information to validate that the recipient is allowed to receive the data. <p class="note">Note: if the calling activity is not expecting a result (that is it did not use the  {@link #startActivityForResult} form that includes a request code), then the calling package will be  null.</p> <p class="note">Note: prior to  {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR2}, the result from this method was unstable.  If the process hosting the calling package was no longer running, it would return null instead of the proper package name.  You can use   {@link #getCallingActivity()} and retrieve the package namefrom that instead.</p>
 * @return The package of the activity that will receive yourreply, or null if none.
 */
public String getCallingPackage(){
  try {
    return ActivityManagerNative.getDefault().getCallingPackage(mToken);
  }
 catch (  RemoteException e) {
    return null;
  }
}
Program: 2355
Project: 2355
Buggy source:
public String getCallingPackage(IBinder token){
synchronized (this) {
    ActivityRecord r=getCallingRecordLocked(token);
    return r != null && r.app != null ? r.info.packageName : null;
  }
}

Fixed version (ground truth):
public String getCallingPackage(IBinder token){
synchronized (this) {
    ActivityRecord r=getCallingRecordLocked(token);
    return r != null ? r.info.packageName : null;
  }
}
Program: 2356
Project: 2356
Buggy source:
/** 
 * Return the name of the activity that invoked this activity.  This is who the data in   {@link #setResult setResult()} will be sent to.  Youcan use this information to validate that the recipient is allowed to receive the data. <p>Note: if the calling activity is not expecting a result (that is it did not use the  {@link #startActivityForResult} form that includes a request code), then the calling package will be  null. 
 * @return String The full name of the activity that will receive yourreply, or null if none.
 */
public ComponentName getCallingActivity(){
  try {
    return ActivityManagerNative.getDefault().getCallingActivity(mToken);
  }
 catch (  RemoteException e) {
    return null;
  }
}

Fixed version (ground truth):
/** 
 * Return the name of the activity that invoked this activity.  This is who the data in   {@link #setResult setResult()} will be sent to.  Youcan use this information to validate that the recipient is allowed to receive the data. <p class="note">Note: if the calling activity is not expecting a result (that is it did not use the  {@link #startActivityForResult} form that includes a request code), then the calling package will be  null. 
 * @return The ComponentName of the activity that will receive yourreply, or null if none.
 */
public ComponentName getCallingActivity(){
  try {
    return ActivityManagerNative.getDefault().getCallingActivity(mToken);
  }
 catch (  RemoteException e) {
    return null;
  }
}
Program: 2357
Project: 2357
Buggy source:
/** 
 * Return the name of the package that invoked this activity.  This is who the data in   {@link #setResult setResult()} will be sent to.  You canuse this information to validate that the recipient is allowed to receive the data. <p>Note: if the calling activity is not expecting a result (that is it did not use the  {@link #startActivityForResult} form that includes a request code), then the calling package will be  null. 
 * @return The package of the activity that will receive yourreply, or null if none.
 */
public String getCallingPackage(){
  try {
    return ActivityManagerNative.getDefault().getCallingPackage(mToken);
  }
 catch (  RemoteException e) {
    return null;
  }
}

Fixed version (ground truth):
/** 
 * Return the name of the package that invoked this activity.  This is who the data in   {@link #setResult setResult()} will be sent to.  You canuse this information to validate that the recipient is allowed to receive the data. <p class="note">Note: if the calling activity is not expecting a result (that is it did not use the  {@link #startActivityForResult} form that includes a request code), then the calling package will be  null.</p> <p class="note">Note: prior to  {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR2}, the result from this method was unstable.  If the process hosting the calling package was no longer running, it would return null instead of the proper package name.  You can use   {@link #getCallingActivity()} and retrieve the package namefrom that instead.</p>
 * @return The package of the activity that will receive yourreply, or null if none.
 */
public String getCallingPackage(){
  try {
    return ActivityManagerNative.getDefault().getCallingPackage(mToken);
  }
 catch (  RemoteException e) {
    return null;
  }
}
Program: 2358
Project: 2358
Buggy source:
public String getCallingPackage(IBinder token){
synchronized (this) {
    ActivityRecord r=getCallingRecordLocked(token);
    return r != null && r.app != null ? r.info.packageName : null;
  }
}

Fixed version (ground truth):
public String getCallingPackage(IBinder token){
synchronized (this) {
    ActivityRecord r=getCallingRecordLocked(token);
    return r != null ? r.info.packageName : null;
  }
}
Program: 2359
Project: 2359
Buggy source:
public static String currentPackageName(){
  ActivityThread am=currentActivityThread();
  return (am != null && am.mBoundApplication != null) ? am.mBoundApplication.processName : null;
}

Fixed version (ground truth):
public static String currentPackageName(){
  ActivityThread am=currentActivityThread();
  return (am != null && am.mBoundApplication != null) ? am.mBoundApplication.appInfo.packageName : null;
}
Program: 2361
Project: 2361
Buggy source:
/** 
 * Return the name of the activity that invoked this activity.  This is who the data in   {@link #setResult setResult()} will be sent to.  Youcan use this information to validate that the recipient is allowed to receive the data. <p>Note: if the calling activity is not expecting a result (that is it did not use the  {@link #startActivityForResult} form that includes a request code), then the calling package will be  null. 
 * @return String The full name of the activity that will receive yourreply, or null if none.
 */
public ComponentName getCallingActivity(){
  try {
    return ActivityManagerNative.getDefault().getCallingActivity(mToken);
  }
 catch (  RemoteException e) {
    return null;
  }
}

Fixed version (ground truth):
/** 
 * Return the name of the activity that invoked this activity.  This is who the data in   {@link #setResult setResult()} will be sent to.  Youcan use this information to validate that the recipient is allowed to receive the data. <p class="note">Note: if the calling activity is not expecting a result (that is it did not use the  {@link #startActivityForResult} form that includes a request code), then the calling package will be  null. 
 * @return The ComponentName of the activity that will receive yourreply, or null if none.
 */
public ComponentName getCallingActivity(){
  try {
    return ActivityManagerNative.getDefault().getCallingActivity(mToken);
  }
 catch (  RemoteException e) {
    return null;
  }
}