nus-yam/ex-repair huggingface dataset:
Program: 22977
Project: 22977
Buggy source:
private int setEngine(String enginePackageName){
  String soFilename="String_Node_Str";
  if (enginePackageName.equals("String_Node_Str")) {
    soFilename="String_Node_Str";
  }
 else {
    Intent intent=new Intent("String_Node_Str");
    intent.setPackage(enginePackageName);
    ResolveInfo[] enginesArray=new ResolveInfo[0];
    PackageManager pm=getPackageManager();
    List<ResolveInfo> resolveInfos=pm.queryIntentActivities(intent,0);
    if ((resolveInfos == null) || resolveInfos.isEmpty()) {
      Log.e(SERVICE_TAG,"String_Node_Str" + enginePackageName);
      return TextToSpeech.ERROR;
    }
    enginesArray=resolveInfos.toArray(enginesArray);
    ActivityInfo aInfo=enginesArray[0].activityInfo;
    soFilename=aInfo.name.replace(aInfo.packageName + "String_Node_Str","String_Node_Str") + "String_Node_Str";
    soFilename=soFilename.toLowerCase();
    soFilename="String_Node_Str" + aInfo.packageName + "String_Node_Str"+ soFilename;
  }
  if (currentSpeechEngineSOFile.equals(soFilename)) {
    return TextToSpeech.SUCCESS;
  }
  File f=new File(soFilename);
  if (!f.exists()) {
    Log.e(SERVICE_TAG,"String_Node_Str" + soFilename);
    return TextToSpeech.ERROR;
  }
  if (sNativeSynth != null) {
    sNativeSynth.stopSync();
    sNativeSynth.shutdown();
    sNativeSynth=null;
  }
  sNativeSynth=new SynthProxy(soFilename);
  currentSpeechEngineSOFile=soFilename;
  return TextToSpeech.SUCCESS;
}

Fixed version (ground truth):
private int setEngine(String enginePackageName){
  String soFilename="String_Node_Str";
  if (isDefaultEnforced()) {
    enginePackageName=getDefaultEngine();
  }
  if (enginePackageName.equals("String_Node_Str")) {
    soFilename="String_Node_Str";
  }
 else {
    Intent intent=new Intent("String_Node_Str");
    intent.setPackage(enginePackageName);
    ResolveInfo[] enginesArray=new ResolveInfo[0];
    PackageManager pm=getPackageManager();
    List<ResolveInfo> resolveInfos=pm.queryIntentActivities(intent,0);
    if ((resolveInfos == null) || resolveInfos.isEmpty()) {
      Log.e(SERVICE_TAG,"String_Node_Str" + enginePackageName);
      return TextToSpeech.ERROR;
    }
    enginesArray=resolveInfos.toArray(enginesArray);
    ActivityInfo aInfo=enginesArray[0].activityInfo;
    soFilename=aInfo.name.replace(aInfo.packageName + "String_Node_Str","String_Node_Str") + "String_Node_Str";
    soFilename=soFilename.toLowerCase();
    soFilename="String_Node_Str" + aInfo.packageName + "String_Node_Str"+ soFilename;
  }
  if (currentSpeechEngineSOFile.equals(soFilename)) {
    return TextToSpeech.SUCCESS;
  }
  File f=new File(soFilename);
  if (!f.exists()) {
    Log.e(SERVICE_TAG,"String_Node_Str" + soFilename);
    return TextToSpeech.ERROR;
  }
  if (sNativeSynth != null) {
    sNativeSynth.stopSync();
    sNativeSynth.shutdown();
    sNativeSynth=null;
  }
  sNativeSynth=new SynthProxy(soFilename);
  currentSpeechEngineSOFile=soFilename;
  return TextToSpeech.SUCCESS;
}
Program: 22980
Project: 22980
Buggy source:
private void commitHeaders(){
  if (mIsMainPageLoader && sCertificateTypeMap.containsKey(mMimeType)) {
    return;
  }
  int nativeResponse=createNativeResponse();
  nativeReceivedResponse(nativeResponse);
}

Fixed version (ground truth):
private void commitHeaders(){
  if (mIsMainPageLoader && sCertificateTypeMap.containsKey(mMimeType)) {
    return;
  }
  if (mAuthHeader != null)   return;
  int nativeResponse=createNativeResponse();
  nativeReceivedResponse(nativeResponse);
}
Program: 22981
Project: 22981
Buggy source:
private void commitHeaders(){
  if (mIsMainPageLoader && sCertificateTypeMap.containsKey(mMimeType)) {
    return;
  }
  int nativeResponse=createNativeResponse();
  nativeReceivedResponse(nativeResponse);
}

Fixed version (ground truth):
private void commitHeaders(){
  if (mIsMainPageLoader && sCertificateTypeMap.containsKey(mMimeType)) {
    return;
  }
  if (mAuthHeader != null)   return;
  int nativeResponse=createNativeResponse();
  nativeReceivedResponse(nativeResponse);
}
Program: 22984
Project: 22984
Buggy source:
private int setEngine(String enginePackageName){
  String soFilename="String_Node_Str";
  if (enginePackageName.equals("String_Node_Str")) {
    soFilename="String_Node_Str";
  }
 else {
    Intent intent=new Intent("String_Node_Str");
    intent.setPackage(enginePackageName);
    ResolveInfo[] enginesArray=new ResolveInfo[0];
    PackageManager pm=getPackageManager();
    List<ResolveInfo> resolveInfos=pm.queryIntentActivities(intent,0);
    if ((resolveInfos == null) || resolveInfos.isEmpty()) {
      Log.e(SERVICE_TAG,"String_Node_Str" + enginePackageName);
      return TextToSpeech.ERROR;
    }
    enginesArray=resolveInfos.toArray(enginesArray);
    ActivityInfo aInfo=enginesArray[0].activityInfo;
    soFilename=aInfo.name.replace(aInfo.packageName + "String_Node_Str","String_Node_Str") + "String_Node_Str";
    soFilename=soFilename.toLowerCase();
    soFilename="String_Node_Str" + aInfo.packageName + "String_Node_Str"+ soFilename;
  }
  if (currentSpeechEngineSOFile.equals(soFilename)) {
    return TextToSpeech.SUCCESS;
  }
  File f=new File(soFilename);
  if (!f.exists()) {
    Log.e(SERVICE_TAG,"String_Node_Str" + soFilename);
    return TextToSpeech.ERROR;
  }
  if (sNativeSynth != null) {
    sNativeSynth.stopSync();
    sNativeSynth.shutdown();
    sNativeSynth=null;
  }
  sNativeSynth=new SynthProxy(soFilename);
  currentSpeechEngineSOFile=soFilename;
  return TextToSpeech.SUCCESS;
}

Fixed version (ground truth):
private int setEngine(String enginePackageName){
  String soFilename="String_Node_Str";
  if (isDefaultEnforced()) {
    enginePackageName=getDefaultEngine();
  }
  if (enginePackageName.equals("String_Node_Str")) {
    soFilename="String_Node_Str";
  }
 else {
    Intent intent=new Intent("String_Node_Str");
    intent.setPackage(enginePackageName);
    ResolveInfo[] enginesArray=new ResolveInfo[0];
    PackageManager pm=getPackageManager();
    List<ResolveInfo> resolveInfos=pm.queryIntentActivities(intent,0);
    if ((resolveInfos == null) || resolveInfos.isEmpty()) {
      Log.e(SERVICE_TAG,"String_Node_Str" + enginePackageName);
      return TextToSpeech.ERROR;
    }
    enginesArray=resolveInfos.toArray(enginesArray);
    ActivityInfo aInfo=enginesArray[0].activityInfo;
    soFilename=aInfo.name.replace(aInfo.packageName + "String_Node_Str","String_Node_Str") + "String_Node_Str";
    soFilename=soFilename.toLowerCase();
    soFilename="String_Node_Str" + aInfo.packageName + "String_Node_Str"+ soFilename;
  }
  if (currentSpeechEngineSOFile.equals(soFilename)) {
    return TextToSpeech.SUCCESS;
  }
  File f=new File(soFilename);
  if (!f.exists()) {
    Log.e(SERVICE_TAG,"String_Node_Str" + soFilename);
    return TextToSpeech.ERROR;
  }
  if (sNativeSynth != null) {
    sNativeSynth.stopSync();
    sNativeSynth.shutdown();
    sNativeSynth=null;
  }
  sNativeSynth=new SynthProxy(soFilename);
  currentSpeechEngineSOFile=soFilename;
  return TextToSpeech.SUCCESS;
}
Program: 22987
Project: 22987
Buggy source:
private void commitHeaders(){
  if (mIsMainPageLoader && sCertificateTypeMap.containsKey(mMimeType)) {
    return;
  }
  int nativeResponse=createNativeResponse();
  nativeReceivedResponse(nativeResponse);
}

Fixed version (ground truth):
private void commitHeaders(){
  if (mIsMainPageLoader && sCertificateTypeMap.containsKey(mMimeType)) {
    return;
  }
  if (mAuthHeader != null)   return;
  int nativeResponse=createNativeResponse();
  nativeReceivedResponse(nativeResponse);
}
Program: 22988
Project: 22988
Buggy source:
Listener(IBinder token){
  mToken=token;
}

Fixed version (ground truth):
Listener(IBinder token,int uid){
  mToken=token;
  mUid=uid;
}
Program: 22989
Project: 22989
Buggy source:
public boolean enableSensor(IBinder binder,String name,int sensor,int enable) throws RemoteException {
  if (localLOGV)   Slog.d(TAG,"String_Node_Str" + name + "String_Node_Str"+ sensor+ "String_Node_Str"+ enable);
  int uid=Binder.getCallingUid();
  long identity=Binder.clearCallingIdentity();
  if (enable == SENSOR_DISABLE) {
    mBatteryStats.noteStopSensor(uid,sensor);
  }
 else {
    mBatteryStats.noteStartSensor(uid,sensor);
  }
  Binder.restoreCallingIdentity(identity);
  if (binder == null) {
    Slog.w(TAG,"String_Node_Str" + name + "String_Node_Str"+ sensor+ "String_Node_Str");
    return false;
  }
synchronized (mListeners) {
    if (enable != SENSOR_DISABLE && !_sensors_control_activate(sensor,true)) {
      Slog.w(TAG,"String_Node_Str" + sensor);
      return false;
    }
    Listener l=null;
    int minDelay=enable;
    for (    Listener listener : mListeners) {
      if (binder == listener.mToken) {
        l=listener;
      }
      if (minDelay > listener.mDelay)       minDelay=listener.mDelay;
    }
    if (l == null && enable != SENSOR_DISABLE) {
      l=new Listener(binder);
      binder.linkToDeath(l,0);
      mListeners.add(l);
      mListeners.notify();
    }
    if (l == null) {
      Slog.w(TAG,"String_Node_Str" + binder + "String_Node_Str"+ name+ "String_Node_Str"+ sensor+ "String_Node_Str");
      return false;
    }
    if (minDelay >= 0) {
      _sensors_control_set_delay(minDelay);
    }
    if (enable != SENSOR_DISABLE) {
      l.addSensor(sensor,enable);
    }
 else {
      l.removeSensor(sensor);
      deactivateIfUnusedLocked(sensor);
      if (l.mSensors == 0) {
        mListeners.remove(l);
        binder.unlinkToDeath(l,0);
        mListeners.notify();
      }
    }
    if (mListeners.size() == 0) {
      _sensors_control_wake();
      _sensors_control_close();
    }
  }
  return true;
}

Fixed version (ground truth):
public boolean enableSensor(IBinder binder,String name,int sensor,int enable) throws RemoteException {
  if (localLOGV)   Slog.d(TAG,"String_Node_Str" + name + "String_Node_Str"+ sensor+ "String_Node_Str"+ enable);
  if (binder == null) {
    Slog.e(TAG,"String_Node_Str" + name + "String_Node_Str"+ sensor+ "String_Node_Str");
    return false;
  }
  if (enable < 0 && (enable != SENSOR_DISABLE)) {
    Slog.e(TAG,"String_Node_Str" + enable + "String_Node_Str"+ name+ "String_Node_Str"+ sensor+ "String_Node_Str");
    return false;
  }
  boolean res;
  int uid=Binder.getCallingUid();
synchronized (mListeners) {
    res=enableSensorInternalLocked(binder,uid,name,sensor,enable);
    if (res == true) {
      long identity=Binder.clearCallingIdentity();
      if (enable == SENSOR_DISABLE) {
        mBatteryStats.noteStopSensor(uid,sensor);
      }
 else {
        mBatteryStats.noteStartSensor(uid,sensor);
      }
      Binder.restoreCallingIdentity(identity);
    }
  }
  return res;
}
Program: 22990
Project: 22990
Buggy source:
void addSensor(int sensor,int delay){
  mSensors|=(1 << sensor);
  if (mDelay > delay)   mDelay=delay;
}

Fixed version (ground truth):
void addSensor(int sensor,int delay){
  mSensors|=(1 << sensor);
  if (delay < mDelay)   mDelay=delay;
}
Program: 22991
Project: 22991
Buggy source:
private void deactivateIfUnusedLocked(int sensor) throws RemoteException {
  int size=mListeners.size();
  for (int i=0; i < size; i++) {
    if (mListeners.get(i).hasSensor(sensor))     return;
  }
  _sensors_control_activate(sensor,false);
}

Fixed version (ground truth):
private void deactivateIfUnusedLocked(int sensor){
  int size=mListeners.size();
  for (int i=0; i < size; i++) {
    if (mListeners.get(i).hasSensor(sensor)) {
      return;
    }
  }
  if (_sensors_control_activate(sensor,false) == false) {
    Slog.w(TAG,"String_Node_Str" + sensor);
  }
}
Program: 22992
Project: 22992
Buggy source:
public void binderDied(){
  if (localLOGV)   Slog.d(TAG,"String_Node_Str");
synchronized (mListeners) {
    mListeners.remove(this);
    mToken.unlinkToDeath(this,0);
    for (int sensor=0; sensor < 32 && mSensors != 0; sensor++) {
      if (hasSensor(sensor)) {
        removeSensor(sensor);
        try {
          deactivateIfUnusedLocked(sensor);
        }
 catch (        RemoteException e) {
          Slog.w(TAG,"String_Node_Str");
        }
      }
    }
    if (mListeners.size() == 0) {
      _sensors_control_wake();
      _sensors_control_close();
    }
    mListeners.notify();
  }
}

Fixed version (ground truth):
public void binderDied(){
  if (localLOGV)   Slog.d(TAG,"String_Node_Str");
synchronized (mListeners) {
    mListeners.remove(this);
    mToken.unlinkToDeath(this,0);
    for (int sensor=0; sensor < 32 && mSensors != 0; sensor++) {
      if (hasSensor(sensor)) {
        removeSensor(sensor);
        deactivateIfUnusedLocked(sensor);
        try {
          mBatteryStats.noteStopSensor(mUid,sensor);
        }
 catch (        RemoteException e) {
        }
      }
    }
    if (mListeners.size() == 0) {
      _sensors_control_wake();
      _sensors_control_close();
    }
 else {
    }
    mListeners.notify();
  }
}
Program: 22997
Project: 22997
Buggy source:
public void onClick(View v){
  if (mSearchable == null) {
    return;
  }
  SearchableInfo searchable=mSearchable;
  cancel();
  try {
    if (searchable.getVoiceSearchLaunchWebSearch()) {
      getContext().startActivity(mVoiceWebSearchIntent);
    }
 else     if (searchable.getVoiceSearchLaunchRecognizer()) {
      Intent appSearchIntent=createVoiceAppSearchIntent(mVoiceAppSearchIntent,searchable);
      getContext().startActivity(appSearchIntent);
    }
  }
 catch (  ActivityNotFoundException e) {
    Log.w(LOG_TAG,"String_Node_Str");
  }
}

Fixed version (ground truth):
public void onClick(View v){
  if (mSearchable == null) {
    return;
  }
  SearchableInfo searchable=mSearchable;
  try {
    if (searchable.getVoiceSearchLaunchWebSearch()) {
      getContext().startActivity(mVoiceWebSearchIntent);
    }
 else     if (searchable.getVoiceSearchLaunchRecognizer()) {
      Intent appSearchIntent=createVoiceAppSearchIntent(mVoiceAppSearchIntent,searchable);
      getContext().startActivity(appSearchIntent);
    }
  }
 catch (  ActivityNotFoundException e) {
    Log.w(LOG_TAG,"String_Node_Str");
  }
  dismiss();
}
Program: 22998
Project: 22998
Buggy source:
/** 
 * The search dialog is being dismissed, so handle all of the local shutdown operations. This function is designed to be idempotent so that dismiss() can be safely called at any time (even if already closed) and more likely to really dump any memory.  No leaks!
 */
@Override public void onStop(){
  super.onStop();
  closeSuggestionsAdapter();
  mLaunchComponent=null;
  mAppSearchData=null;
  mSearchable=null;
  mActivityContext=null;
  mUserQuery=null;
}

Fixed version (ground truth):
/** 
 * The search dialog is being dismissed, so handle all of the local shutdown operations. This function is designed to be idempotent so that dismiss() can be safely called at any time (even if already closed) and more likely to really dump any memory.  No leaks!
 */
@Override public void onStop(){
  super.onStop();
  closeSuggestionsAdapter();
  mLaunchComponent=null;
  mAppSearchData=null;
  mSearchable=null;
  mUserQuery=null;
}
Program: 22999
Project: 22999
Buggy source:
/** 
 * Update the UI according to the info in the current value of   {@link #mSearchable}.
 */
private void updateUI(){
  if (mSearchable != null) {
    mDecor.setVisibility(View.VISIBLE);
    updateSearchAutoComplete();
    updateSearchButton();
    updateSearchAppIcon();
    updateSearchBadge();
    updateQueryHint();
    updateVoiceButton();
    int inputType=mSearchable.getInputType();
    if ((inputType & InputType.TYPE_MASK_CLASS) == InputType.TYPE_CLASS_TEXT) {
      inputType&=~InputType.TYPE_TEXT_FLAG_AUTO_COMPLETE;
      if (mSearchable.getSuggestAuthority() != null) {
        inputType|=InputType.TYPE_TEXT_FLAG_AUTO_COMPLETE;
      }
    }
    mSearchAutoComplete.setInputType(inputType);
    mSearchAutoCompleteImeOptions=mSearchable.getImeOptions();
    mSearchAutoComplete.setImeOptions(mSearchAutoCompleteImeOptions);
    if (mSearchable.getVoiceSearchEnabled()) {
      mSearchAutoComplete.setPrivateImeOptions(IME_OPTION_NO_MICROPHONE);
    }
 else {
      mSearchAutoComplete.setPrivateImeOptions(null);
    }
  }
}

Fixed version (ground truth):
/** 
 * Update the UI according to the info in the current value of   {@link #mSearchable}.
 */
private void updateUI(){
  if (mSearchable != null) {
    mDecor.setVisibility(View.VISIBLE);
    updateSearchAutoComplete();
    updateSearchButton();
    updateSearchAppIcon();
    updateSearchBadge();
    updateQueryHint();
    updateVoiceButton(TextUtils.isEmpty(mUserQuery));
    int inputType=mSearchable.getInputType();
    if ((inputType & InputType.TYPE_MASK_CLASS) == InputType.TYPE_CLASS_TEXT) {
      inputType&=~InputType.TYPE_TEXT_FLAG_AUTO_COMPLETE;
      if (mSearchable.getSuggestAuthority() != null) {
        inputType|=InputType.TYPE_TEXT_FLAG_AUTO_COMPLETE;
      }
    }
    mSearchAutoComplete.setInputType(inputType);
    mSearchAutoCompleteImeOptions=mSearchable.getImeOptions();
    mSearchAutoComplete.setImeOptions(mSearchAutoCompleteImeOptions);
    if (mSearchable.getVoiceSearchEnabled()) {
      mSearchAutoComplete.setPrivateImeOptions(IME_OPTION_NO_MICROPHONE);
    }
 else {
      mSearchAutoComplete.setPrivateImeOptions(null);
    }
  }
}
Program: 23000
Project: 23000
Buggy source:
public void onTextChanged(CharSequence s,int start,int before,int after){
  if (DBG_LOG_TIMING) {
    dbgLogTiming("String_Node_Str");
  }
  if (mSearchable == null) {
    return;
  }
  updateWidgetState();
  if (!mSearchAutoComplete.isPerformingCompletion()) {
    mUserQuery=s == null ? "String_Node_Str" : s.toString();
  }
}

Fixed version (ground truth):
public void onTextChanged(CharSequence s,int start,int before,int after){
  if (DBG_LOG_TIMING) {
    dbgLogTiming("String_Node_Str");
  }
  if (mSearchable == null) {
    return;
  }
  updateWidgetState();
  if (!mSearchAutoComplete.isPerformingCompletion()) {
    mUserQuery=s == null ? "String_Node_Str" : s.toString();
  }
  updateVoiceButton(TextUtils.isEmpty(s));
}
Program: 23001
Project: 23001
Buggy source:
/** 
 * Update the visibility of the voice button.  There are actually two voice search modes,  either of which will activate the button.
 */
private void updateVoiceButton(){
  int visibility=View.GONE;
  if (mSearchable.getVoiceSearchEnabled()) {
    Intent testIntent=null;
    if (mSearchable.getVoiceSearchLaunchWebSearch()) {
      testIntent=mVoiceWebSearchIntent;
    }
 else     if (mSearchable.getVoiceSearchLaunchRecognizer()) {
      testIntent=mVoiceAppSearchIntent;
    }
    if (testIntent != null) {
      ResolveInfo ri=getContext().getPackageManager().resolveActivity(testIntent,PackageManager.MATCH_DEFAULT_ONLY);
      if (ri != null) {
        visibility=View.VISIBLE;
      }
    }
  }
  mVoiceButton.setVisibility(visibility);
}

Fixed version (ground truth):
/** 
 * Update the visibility of the voice button.  There are actually two voice search modes,  either of which will activate the button.
 * @param empty whether the search query text field is empty. If it is, then the othercriteria apply to make the voice button visible. Otherwise the voice button will not be visible - i.e., if the user has typed a query, remove the voice button.
 */
private void updateVoiceButton(boolean empty){
  int visibility=View.GONE;
  if (mSearchable.getVoiceSearchEnabled() && empty) {
    Intent testIntent=null;
    if (mSearchable.getVoiceSearchLaunchWebSearch()) {
      testIntent=mVoiceWebSearchIntent;
    }
 else     if (mSearchable.getVoiceSearchLaunchRecognizer()) {
      testIntent=mVoiceAppSearchIntent;
    }
    if (testIntent != null) {
      ResolveInfo ri=getContext().getPackageManager().resolveActivity(testIntent,PackageManager.MATCH_DEFAULT_ONLY);
      if (ri != null) {
        visibility=View.VISIBLE;
      }
    }
  }
  mVoiceButton.setVisibility(visibility);
}
Program: 23002
Project: 23002
Buggy source:
public void onClick(View v){
  if (mSearchable == null) {
    return;
  }
  SearchableInfo searchable=mSearchable;
  cancel();
  try {
    if (searchable.getVoiceSearchLaunchWebSearch()) {
      getContext().startActivity(mVoiceWebSearchIntent);
    }
 else     if (searchable.getVoiceSearchLaunchRecognizer()) {
      Intent appSearchIntent=createVoiceAppSearchIntent(mVoiceAppSearchIntent,searchable);
      getContext().startActivity(appSearchIntent);
    }
  }
 catch (  ActivityNotFoundException e) {
    Log.w(LOG_TAG,"String_Node_Str");
  }
}

Fixed version (ground truth):
public void onClick(View v){
  if (mSearchable == null) {
    return;
  }
  SearchableInfo searchable=mSearchable;
  try {
    if (searchable.getVoiceSearchLaunchWebSearch()) {
      getContext().startActivity(mVoiceWebSearchIntent);
    }
 else     if (searchable.getVoiceSearchLaunchRecognizer()) {
      Intent appSearchIntent=createVoiceAppSearchIntent(mVoiceAppSearchIntent,searchable);
      getContext().startActivity(appSearchIntent);
    }
  }
 catch (  ActivityNotFoundException e) {
    Log.w(LOG_TAG,"String_Node_Str");
  }
  dismiss();
}
Program: 23003
Project: 23003
Buggy source:
/** 
 * The search dialog is being dismissed, so handle all of the local shutdown operations. This function is designed to be idempotent so that dismiss() can be safely called at any time (even if already closed) and more likely to really dump any memory.  No leaks!
 */
@Override public void onStop(){
  super.onStop();
  closeSuggestionsAdapter();
  mLaunchComponent=null;
  mAppSearchData=null;
  mSearchable=null;
  mActivityContext=null;
  mUserQuery=null;
}

Fixed version (ground truth):
/** 
 * The search dialog is being dismissed, so handle all of the local shutdown operations. This function is designed to be idempotent so that dismiss() can be safely called at any time (even if already closed) and more likely to really dump any memory.  No leaks!
 */
@Override public void onStop(){
  super.onStop();
  closeSuggestionsAdapter();
  mLaunchComponent=null;
  mAppSearchData=null;
  mSearchable=null;
  mUserQuery=null;
}
Program: 23004
Project: 23004
Buggy source:
/** 
 * Update the UI according to the info in the current value of   {@link #mSearchable}.
 */
private void updateUI(){
  if (mSearchable != null) {
    mDecor.setVisibility(View.VISIBLE);
    updateSearchAutoComplete();
    updateSearchButton();
    updateSearchAppIcon();
    updateSearchBadge();
    updateQueryHint();
    updateVoiceButton();
    int inputType=mSearchable.getInputType();
    if ((inputType & InputType.TYPE_MASK_CLASS) == InputType.TYPE_CLASS_TEXT) {
      inputType&=~InputType.TYPE_TEXT_FLAG_AUTO_COMPLETE;
      if (mSearchable.getSuggestAuthority() != null) {
        inputType|=InputType.TYPE_TEXT_FLAG_AUTO_COMPLETE;
      }
    }
    mSearchAutoComplete.setInputType(inputType);
    mSearchAutoCompleteImeOptions=mSearchable.getImeOptions();
    mSearchAutoComplete.setImeOptions(mSearchAutoCompleteImeOptions);
    if (mSearchable.getVoiceSearchEnabled()) {
      mSearchAutoComplete.setPrivateImeOptions(IME_OPTION_NO_MICROPHONE);
    }
 else {
      mSearchAutoComplete.setPrivateImeOptions(null);
    }
  }
}

Fixed version (ground truth):
/** 
 * Update the UI according to the info in the current value of   {@link #mSearchable}.
 */
private void updateUI(){
  if (mSearchable != null) {
    mDecor.setVisibility(View.VISIBLE);
    updateSearchAutoComplete();
    updateSearchButton();
    updateSearchAppIcon();
    updateSearchBadge();
    updateQueryHint();
    updateVoiceButton(TextUtils.isEmpty(mUserQuery));
    int inputType=mSearchable.getInputType();
    if ((inputType & InputType.TYPE_MASK_CLASS) == InputType.TYPE_CLASS_TEXT) {
      inputType&=~InputType.TYPE_TEXT_FLAG_AUTO_COMPLETE;
      if (mSearchable.getSuggestAuthority() != null) {
        inputType|=InputType.TYPE_TEXT_FLAG_AUTO_COMPLETE;
      }
    }
    mSearchAutoComplete.setInputType(inputType);
    mSearchAutoCompleteImeOptions=mSearchable.getImeOptions();
    mSearchAutoComplete.setImeOptions(mSearchAutoCompleteImeOptions);
    if (mSearchable.getVoiceSearchEnabled()) {
      mSearchAutoComplete.setPrivateImeOptions(IME_OPTION_NO_MICROPHONE);
    }
 else {
      mSearchAutoComplete.setPrivateImeOptions(null);
    }
  }
}
Program: 23005
Project: 23005
Buggy source:
public void onTextChanged(CharSequence s,int start,int before,int after){
  if (DBG_LOG_TIMING) {
    dbgLogTiming("String_Node_Str");
  }
  if (mSearchable == null) {
    return;
  }
  updateWidgetState();
  if (!mSearchAutoComplete.isPerformingCompletion()) {
    mUserQuery=s == null ? "String_Node_Str" : s.toString();
  }
}

Fixed version (ground truth):
public void onTextChanged(CharSequence s,int start,int before,int after){
  if (DBG_LOG_TIMING) {
    dbgLogTiming("String_Node_Str");
  }
  if (mSearchable == null) {
    return;
  }
  updateWidgetState();
  if (!mSearchAutoComplete.isPerformingCompletion()) {
    mUserQuery=s == null ? "String_Node_Str" : s.toString();
  }
  updateVoiceButton(TextUtils.isEmpty(s));
}
Program: 23006
Project: 23006
Buggy source:
/** 
 * Update the visibility of the voice button.  There are actually two voice search modes,  either of which will activate the button.
 */
private void updateVoiceButton(){
  int visibility=View.GONE;
  if (mSearchable.getVoiceSearchEnabled()) {
    Intent testIntent=null;
    if (mSearchable.getVoiceSearchLaunchWebSearch()) {
      testIntent=mVoiceWebSearchIntent;
    }
 else     if (mSearchable.getVoiceSearchLaunchRecognizer()) {
      testIntent=mVoiceAppSearchIntent;
    }
    if (testIntent != null) {
      ResolveInfo ri=getContext().getPackageManager().resolveActivity(testIntent,PackageManager.MATCH_DEFAULT_ONLY);
      if (ri != null) {
        visibility=View.VISIBLE;
      }
    }
  }
  mVoiceButton.setVisibility(visibility);
}

Fixed version (ground truth):
/** 
 * Update the visibility of the voice button.  There are actually two voice search modes,  either of which will activate the button.
 * @param empty whether the search query text field is empty. If it is, then the othercriteria apply to make the voice button visible. Otherwise the voice button will not be visible - i.e., if the user has typed a query, remove the voice button.
 */
private void updateVoiceButton(boolean empty){
  int visibility=View.GONE;
  if (mSearchable.getVoiceSearchEnabled() && empty) {
    Intent testIntent=null;
    if (mSearchable.getVoiceSearchLaunchWebSearch()) {
      testIntent=mVoiceWebSearchIntent;
    }
 else     if (mSearchable.getVoiceSearchLaunchRecognizer()) {
      testIntent=mVoiceAppSearchIntent;
    }
    if (testIntent != null) {
      ResolveInfo ri=getContext().getPackageManager().resolveActivity(testIntent,PackageManager.MATCH_DEFAULT_ONLY);
      if (ri != null) {
        visibility=View.VISIBLE;
      }
    }
  }
  mVoiceButton.setVisibility(visibility);
}
Program: 23007
Project: 23007
Buggy source:
@Override public boolean onTouchEvent(MotionEvent ev){
  if (ev.getAction() == MotionEvent.ACTION_DOWN && ev.getEdgeFlags() != 0) {
    return false;
  }
  if (mVelocityTracker == null) {
    mVelocityTracker=VelocityTracker.obtain();
  }
  mVelocityTracker.addMovement(ev);
  final int action=ev.getAction();
  final float y=ev.getY();
switch (action) {
case MotionEvent.ACTION_DOWN:
    if (!mScroller.isFinished()) {
      mScroller.abortAnimation();
    }
  if (!inChild((int)ev.getX(),(int)y)) {
    mIsBeingDragged=false;
    return false;
  }
mLastMotionY=y;
break;
case MotionEvent.ACTION_MOVE:
if (mIsBeingDragged) {
final int deltaY=(int)(mLastMotionY - y);
mLastMotionY=y;
overscrollBy(0,deltaY,0,mScrollY,0,getScrollRange(),0,getOverscrollMax());
break;
}
case MotionEvent.ACTION_UP:
if (mIsBeingDragged) {
final VelocityTracker velocityTracker=mVelocityTracker;
velocityTracker.computeCurrentVelocity(1000,mMaximumVelocity);
int initialVelocity=(int)velocityTracker.getYVelocity();
if (getChildCount() > 0) {
if ((Math.abs(initialVelocity) > mMinimumVelocity)) {
fling(-initialVelocity);
}
 else {
final int bottom=getScrollRange();
if (mScroller.springback(mScrollX,mScrollY,0,0,0,bottom)) {
  invalidate();
}
}
}
if (mVelocityTracker != null) {
mVelocityTracker.recycle();
mVelocityTracker=null;
}
}
}
return true;
}

Fixed version (ground truth):
@Override public boolean onTouchEvent(MotionEvent ev){
  if (ev.getAction() == MotionEvent.ACTION_DOWN && ev.getEdgeFlags() != 0) {
    return false;
  }
  if (mVelocityTracker == null) {
    mVelocityTracker=VelocityTracker.obtain();
  }
  mVelocityTracker.addMovement(ev);
  final int action=ev.getAction();
switch (action & MotionEvent.ACTION_MASK) {
case MotionEvent.ACTION_DOWN:
{
      if (!mScroller.isFinished()) {
        mScroller.abortAnimation();
      }
      final float y=ev.getY();
      if (!(mIsBeingDragged=inChild((int)ev.getX(),(int)y))) {
        return false;
      }
      mLastMotionY=y;
      mActivePointerId=ev.getPointerId(0);
      break;
    }
case MotionEvent.ACTION_MOVE:
  if (mIsBeingDragged) {
    final int activePointerIndex=ev.findPointerIndex(mActivePointerId);
    final float y=ev.getY(activePointerIndex);
    final int deltaY=(int)(mLastMotionY - y);
    mLastMotionY=y;
    overscrollBy(0,deltaY,0,mScrollY,0,getScrollRange(),0,getOverscrollMax());
  }
break;
case MotionEvent.ACTION_UP:
if (mIsBeingDragged) {
final VelocityTracker velocityTracker=mVelocityTracker;
velocityTracker.computeCurrentVelocity(1000,mMaximumVelocity);
int initialVelocity=(int)velocityTracker.getYVelocity(mActivePointerId);
if (getChildCount() > 0) {
  if ((Math.abs(initialVelocity) > mMinimumVelocity)) {
    fling(-initialVelocity);
  }
 else {
    final int bottom=getScrollRange();
    if (mScroller.springback(mScrollX,mScrollY,0,0,0,bottom)) {
      invalidate();
    }
  }
}
mActivePointerId=INVALID_POINTER;
mIsBeingDragged=false;
if (mVelocityTracker != null) {
  mVelocityTracker.recycle();
  mVelocityTracker=null;
}
}
break;
case MotionEvent.ACTION_POINTER_UP:
onSecondaryPointerUp(ev);
break;
}
return true;
}
Program: 23008
Project: 23008
Buggy source:
@Override public boolean onInterceptTouchEvent(MotionEvent ev){
  final int action=ev.getAction();
  if ((action == MotionEvent.ACTION_MOVE) && (mIsBeingDragged)) {
    return true;
  }
  final float y=ev.getY();
switch (action) {
case MotionEvent.ACTION_MOVE:
    final int yDiff=(int)Math.abs(y - mLastMotionY);
  if (yDiff > mTouchSlop) {
    mIsBeingDragged=true;
    mLastMotionY=y;
  }
break;
case MotionEvent.ACTION_DOWN:
if (!inChild((int)ev.getX(),(int)y)) {
mIsBeingDragged=false;
break;
}
mLastMotionY=y;
mIsBeingDragged=!mScroller.isFinished();
break;
case MotionEvent.ACTION_CANCEL:
case MotionEvent.ACTION_UP:
mIsBeingDragged=false;
break;
}
return mIsBeingDragged;
}

Fixed version (ground truth):
@Override public boolean onInterceptTouchEvent(MotionEvent ev){
  final int action=ev.getAction();
  if ((action == MotionEvent.ACTION_MOVE) && (mIsBeingDragged)) {
    return true;
  }
switch (action & MotionEvent.ACTION_MASK) {
case MotionEvent.ACTION_MOVE:
{
      final int pointerIndex=ev.findPointerIndex(mActivePointerId);
      final float y=ev.getY(pointerIndex);
      final int yDiff=(int)Math.abs(y - mLastMotionY);
      if (yDiff > mTouchSlop) {
        mIsBeingDragged=true;
        mLastMotionY=y;
      }
      break;
    }
case MotionEvent.ACTION_DOWN:
{
    final float y=ev.getY();
    if (!inChild((int)ev.getX(),(int)y)) {
      mIsBeingDragged=false;
      break;
    }
    mLastMotionY=y;
    mActivePointerId=ev.getPointerId(0);
    mIsBeingDragged=!mScroller.isFinished();
    break;
  }
case MotionEvent.ACTION_CANCEL:
case MotionEvent.ACTION_UP:
mIsBeingDragged=false;
mActivePointerId=INVALID_POINTER;
break;
case MotionEvent.ACTION_POINTER_UP:
onSecondaryPointerUp(ev);
break;
}
return mIsBeingDragged;
}
Program: 23009
Project: 23009
Buggy source:
@Override public boolean onTouchEvent(MotionEvent ev){
  if (ev.getAction() == MotionEvent.ACTION_DOWN && ev.getEdgeFlags() != 0) {
    return false;
  }
  if (mVelocityTracker == null) {
    mVelocityTracker=VelocityTracker.obtain();
  }
  mVelocityTracker.addMovement(ev);
  final int action=ev.getAction();
  final float y=ev.getY();
switch (action) {
case MotionEvent.ACTION_DOWN:
    if (!mScroller.isFinished()) {
      mScroller.abortAnimation();
    }
  if (!inChild((int)ev.getX(),(int)y)) {
    mIsBeingDragged=false;
    return false;
  }
mLastMotionY=y;
break;
case MotionEvent.ACTION_MOVE:
if (mIsBeingDragged) {
final int deltaY=(int)(mLastMotionY - y);
mLastMotionY=y;
overscrollBy(0,deltaY,0,mScrollY,0,getScrollRange(),0,getOverscrollMax());
break;
}
case MotionEvent.ACTION_UP:
if (mIsBeingDragged) {
final VelocityTracker velocityTracker=mVelocityTracker;
velocityTracker.computeCurrentVelocity(1000,mMaximumVelocity);
int initialVelocity=(int)velocityTracker.getYVelocity();
if (getChildCount() > 0) {
if ((Math.abs(initialVelocity) > mMinimumVelocity)) {
fling(-initialVelocity);
}
 else {
final int bottom=getScrollRange();
if (mScroller.springback(mScrollX,mScrollY,0,0,0,bottom)) {
  invalidate();
}
}
}
if (mVelocityTracker != null) {
mVelocityTracker.recycle();
mVelocityTracker=null;
}
}
}
return true;
}

Fixed version (ground truth):
@Override public boolean onTouchEvent(MotionEvent ev){
  if (ev.getAction() == MotionEvent.ACTION_DOWN && ev.getEdgeFlags() != 0) {
    return false;
  }
  if (mVelocityTracker == null) {
    mVelocityTracker=VelocityTracker.obtain();
  }
  mVelocityTracker.addMovement(ev);
  final int action=ev.getAction();
switch (action & MotionEvent.ACTION_MASK) {
case MotionEvent.ACTION_DOWN:
{
      if (!mScroller.isFinished()) {
        mScroller.abortAnimation();
      }
      final float y=ev.getY();
      if (!(mIsBeingDragged=inChild((int)ev.getX(),(int)y))) {
        return false;
      }
      mLastMotionY=y;
      mActivePointerId=ev.getPointerId(0);
      break;
    }
case MotionEvent.ACTION_MOVE:
  if (mIsBeingDragged) {
    final int activePointerIndex=ev.findPointerIndex(mActivePointerId);
    final float y=ev.getY(activePointerIndex);
    final int deltaY=(int)(mLastMotionY - y);
    mLastMotionY=y;
    overscrollBy(0,deltaY,0,mScrollY,0,getScrollRange(),0,getOverscrollMax());
  }
break;
case MotionEvent.ACTION_UP:
if (mIsBeingDragged) {
final VelocityTracker velocityTracker=mVelocityTracker;
velocityTracker.computeCurrentVelocity(1000,mMaximumVelocity);
int initialVelocity=(int)velocityTracker.getYVelocity(mActivePointerId);
if (getChildCount() > 0) {
  if ((Math.abs(initialVelocity) > mMinimumVelocity)) {
    fling(-initialVelocity);
  }
 else {
    final int bottom=getScrollRange();
    if (mScroller.springback(mScrollX,mScrollY,0,0,0,bottom)) {
      invalidate();
    }
  }
}
mActivePointerId=INVALID_POINTER;
mIsBeingDragged=false;
if (mVelocityTracker != null) {
  mVelocityTracker.recycle();
  mVelocityTracker=null;
}
}
break;
case MotionEvent.ACTION_POINTER_UP:
onSecondaryPointerUp(ev);
break;
}
return true;
}
Program: 23010
Project: 23010
Buggy source:
@Override public boolean onInterceptTouchEvent(MotionEvent ev){
  final int action=ev.getAction();
  if ((action == MotionEvent.ACTION_MOVE) && (mIsBeingDragged)) {
    return true;
  }
  final float y=ev.getY();
switch (action) {
case MotionEvent.ACTION_MOVE:
    final int yDiff=(int)Math.abs(y - mLastMotionY);
  if (yDiff > mTouchSlop) {
    mIsBeingDragged=true;
    mLastMotionY=y;
  }
break;
case MotionEvent.ACTION_DOWN:
if (!inChild((int)ev.getX(),(int)y)) {
mIsBeingDragged=false;
break;
}
mLastMotionY=y;
mIsBeingDragged=!mScroller.isFinished();
break;
case MotionEvent.ACTION_CANCEL:
case MotionEvent.ACTION_UP:
mIsBeingDragged=false;
break;
}
return mIsBeingDragged;
}

Fixed version (ground truth):
@Override public boolean onInterceptTouchEvent(MotionEvent ev){
  final int action=ev.getAction();
  if ((action == MotionEvent.ACTION_MOVE) && (mIsBeingDragged)) {
    return true;
  }
switch (action & MotionEvent.ACTION_MASK) {
case MotionEvent.ACTION_MOVE:
{
      final int pointerIndex=ev.findPointerIndex(mActivePointerId);
      final float y=ev.getY(pointerIndex);
      final int yDiff=(int)Math.abs(y - mLastMotionY);
      if (yDiff > mTouchSlop) {
        mIsBeingDragged=true;
        mLastMotionY=y;
      }
      break;
    }
case MotionEvent.ACTION_DOWN:
{
    final float y=ev.getY();
    if (!inChild((int)ev.getX(),(int)y)) {
      mIsBeingDragged=false;
      break;
    }
    mLastMotionY=y;
    mActivePointerId=ev.getPointerId(0);
    mIsBeingDragged=!mScroller.isFinished();
    break;
  }
case MotionEvent.ACTION_CANCEL:
case MotionEvent.ACTION_UP:
mIsBeingDragged=false;
mActivePointerId=INVALID_POINTER;
break;
case MotionEvent.ACTION_POINTER_UP:
onSecondaryPointerUp(ev);
break;
}
return mIsBeingDragged;
}
Program: 23011
Project: 23011
Buggy source:
SQLiteProgram(SQLiteDatabase db,String sql){
  mDatabase=db;
  mSql=sql;
  db.acquireReference();
  db.addSQLiteClosable(this);
  this.nHandle=db.mNativeHandle;
  mCompiledSql=db.getCompiledStatementForSql(sql);
  if (mCompiledSql == null) {
    mCompiledSql=new SQLiteCompiledSql(db,sql);
    db.addToCompiledQueries(sql,mCompiledSql);
    mCompiledSql.acquire();
  }
 else {
    if (!mCompiledSql.acquire()) {
      mCompiledSql=new SQLiteCompiledSql(db,sql);
    }
  }
  nStatement=mCompiledSql.nStatement;
}

Fixed version (ground truth):
SQLiteProgram(SQLiteDatabase db,String sql){
  mDatabase=db;
  mSql=sql;
  db.acquireReference();
  db.addSQLiteClosable(this);
  this.nHandle=db.mNativeHandle;
  mCompiledSql=db.getCompiledStatementForSql(sql);
  if (mCompiledSql == null) {
    mCompiledSql=new SQLiteCompiledSql(db,sql);
    mCompiledSql.acquire();
    db.addToCompiledQueries(sql,mCompiledSql);
  }
 else {
    if (!mCompiledSql.acquire()) {
      mCompiledSql=new SQLiteCompiledSql(db,sql);
    }
  }
  nStatement=mCompiledSql.nStatement;
}
Program: 23012
Project: 23012
Buggy source:
SQLiteProgram(SQLiteDatabase db,String sql){
  mDatabase=db;
  mSql=sql;
  db.acquireReference();
  db.addSQLiteClosable(this);
  this.nHandle=db.mNativeHandle;
  mCompiledSql=db.getCompiledStatementForSql(sql);
  if (mCompiledSql == null) {
    mCompiledSql=new SQLiteCompiledSql(db,sql);
    db.addToCompiledQueries(sql,mCompiledSql);
    mCompiledSql.acquire();
  }
 else {
    if (!mCompiledSql.acquire()) {
      mCompiledSql=new SQLiteCompiledSql(db,sql);
    }
  }
  nStatement=mCompiledSql.nStatement;
}

Fixed version (ground truth):
SQLiteProgram(SQLiteDatabase db,String sql){
  mDatabase=db;
  mSql=sql;
  db.acquireReference();
  db.addSQLiteClosable(this);
  this.nHandle=db.mNativeHandle;
  mCompiledSql=db.getCompiledStatementForSql(sql);
  if (mCompiledSql == null) {
    mCompiledSql=new SQLiteCompiledSql(db,sql);
    mCompiledSql.acquire();
    db.addToCompiledQueries(sql,mCompiledSql);
  }
 else {
    if (!mCompiledSql.acquire()) {
      mCompiledSql=new SQLiteCompiledSql(db,sql);
    }
  }
  nStatement=mCompiledSql.nStatement;
}
Program: 23013
Project: 23013
Buggy source:
final void releaseTheme(int theme){
synchronized (this) {
    deleteTheme(theme);
    decRefsLocked();
  }
}

Fixed version (ground truth):
final void releaseTheme(int theme){
synchronized (this) {
    deleteTheme(theme);
    decRefsLocked(theme);
  }
}
Program: 23014
Project: 23014
Buggy source:
private final void decRefsLocked(){
  mNumRefs--;
  if (mNumRefs == 0) {
    destroy();
  }
}

Fixed version (ground truth):
private final void decRefsLocked(int id){
  if (DEBUG_REFS && mRefStacks != null) {
    mRefStacks.remove(id);
  }
  mNumRefs--;
  if (mNumRefs == 0) {
    destroy();
  }
}
Program: 23015
Project: 23015
Buggy source:
final int createTheme(){
synchronized (this) {
    if (!mOpen) {
      throw new RuntimeException("String_Node_Str");
    }
    mNumRefs++;
    return newTheme();
  }
}

Fixed version (ground truth):
final int createTheme(){
synchronized (this) {
    if (!mOpen) {
      throw new RuntimeException("String_Node_Str");
    }
    int res=newTheme();
    incRefsLocked(res);
    return res;
  }
}
Program: 23016
Project: 23016
Buggy source:
public final void close() throws IOException {
synchronized (AssetManager.this) {
    if (mAsset != 0) {
      destroyAsset(mAsset);
      mAsset=0;
      decRefsLocked();
    }
  }
}

Fixed version (ground truth):
public final void close() throws IOException {
synchronized (AssetManager.this) {
    if (mAsset != 0) {
      destroyAsset(mAsset);
      mAsset=0;
      decRefsLocked(hashCode());
    }
  }
}
Program: 23017
Project: 23017
Buggy source:
private AssetManager(boolean isSystem){
  init();
  if (localLOGV)   Log.v(TAG,"String_Node_Str" + this);
}

Fixed version (ground truth):
private AssetManager(boolean isSystem){
  if (DEBUG_REFS) {
synchronized (this) {
      mNumRefs=0;
      incRefsLocked(this.hashCode());
    }
  }
  init();
  if (localLOGV)   Log.v(TAG,"String_Node_Str" + this);
}
Program: 23018
Project: 23018
Buggy source:
/** 
 * {@hide}Retrieve a non-asset as a compiled XML file.  Not for use by applications.
 * @param cookie Identifier of the package to be opened.
 * @param fileName Name of the asset to retrieve.
 */
final XmlBlock openXmlBlockAsset(int cookie,String fileName) throws IOException {
synchronized (this) {
    if (!mOpen) {
      throw new RuntimeException("String_Node_Str");
    }
    int xmlBlock=openXmlAssetNative(cookie,fileName);
    if (xmlBlock != 0) {
      mNumRefs++;
      return new XmlBlock(this,xmlBlock);
    }
  }
  throw new FileNotFoundException("String_Node_Str" + fileName);
}

Fixed version (ground truth):
/** 
 * {@hide}Retrieve a non-asset as a compiled XML file.  Not for use by applications.
 * @param cookie Identifier of the package to be opened.
 * @param fileName Name of the asset to retrieve.
 */
final XmlBlock openXmlBlockAsset(int cookie,String fileName) throws IOException {
synchronized (this) {
    if (!mOpen) {
      throw new RuntimeException("String_Node_Str");
    }
    int xmlBlock=openXmlAssetNative(cookie,fileName);
    if (xmlBlock != 0) {
      XmlBlock res=new XmlBlock(this,xmlBlock);
      incRefsLocked(res.hashCode());
      return res;
    }
  }
  throw new FileNotFoundException("String_Node_Str" + fileName);
}
Program: 23019
Project: 23019
Buggy source:
/** 
 * {@hide}Open a non-asset in a specified package.  Not for use by applications.
 * @param cookie Identifier of the package to be opened.
 * @param fileName Name of the asset to retrieve.
 * @param accessMode Desired access mode for retrieving the data.
 */
public final InputStream openNonAsset(int cookie,String fileName,int accessMode) throws IOException {
synchronized (this) {
    if (!mOpen) {
      throw new RuntimeException("String_Node_Str");
    }
    int asset=openNonAssetNative(cookie,fileName,accessMode);
    if (asset != 0) {
      mNumRefs++;
      return new AssetInputStream(asset);
    }
  }
  throw new FileNotFoundException("String_Node_Str" + fileName);
}

Fixed version (ground truth):
/** 
 * {@hide}Open a non-asset in a specified package.  Not for use by applications.
 * @param cookie Identifier of the package to be opened.
 * @param fileName Name of the asset to retrieve.
 * @param accessMode Desired access mode for retrieving the data.
 */
public final InputStream openNonAsset(int cookie,String fileName,int accessMode) throws IOException {
synchronized (this) {
    if (!mOpen) {
      throw new RuntimeException("String_Node_Str");
    }
    int asset=openNonAssetNative(cookie,fileName,accessMode);
    if (asset != 0) {
      AssetInputStream res=new AssetInputStream(asset);
      incRefsLocked(res.hashCode());
      return res;
    }
  }
  throw new FileNotFoundException("String_Node_Str" + fileName);
}
Program: 23020
Project: 23020
Buggy source:
void xmlBlockGone(){
synchronized (this) {
    decRefsLocked();
  }
}

Fixed version (ground truth):
void xmlBlockGone(int id){
synchronized (this) {
    decRefsLocked(id);
  }
}
Program: 23021
Project: 23021
Buggy source:
/** 
 * Open an asset using an explicit access mode, returning an InputStream to read its contents.  This provides access to files that have been bundled with an application as assets -- that is, files placed in to the "assets" directory.
 * @param fileName The name of the asset to open.  This name can behierarchical.
 * @param accessMode Desired access mode for retrieving the data.
 * @see #ACCESS_UNKNOWN
 * @see #ACCESS_STREAMING
 * @see #ACCESS_RANDOM
 * @see #ACCESS_BUFFER
 * @see #open(String)
 * @see #list
 */
public final InputStream open(String fileName,int accessMode) throws IOException {
synchronized (this) {
    if (!mOpen) {
      throw new RuntimeException("String_Node_Str");
    }
    int asset=openAsset(fileName,accessMode);
    if (asset != 0) {
      mNumRefs++;
      return new AssetInputStream(asset);
    }
  }
  throw new FileNotFoundException("String_Node_Str" + fileName);
}

Fixed version (ground truth):
/** 
 * Open an asset using an explicit access mode, returning an InputStream to read its contents.  This provides access to files that have been bundled with an application as assets -- that is, files placed in to the "assets" directory.
 * @param fileName The name of the asset to open.  This name can behierarchical.
 * @param accessMode Desired access mode for retrieving the data.
 * @see #ACCESS_UNKNOWN
 * @see #ACCESS_STREAMING
 * @see #ACCESS_RANDOM
 * @see #ACCESS_BUFFER
 * @see #open(String)
 * @see #list
 */
public final InputStream open(String fileName,int accessMode) throws IOException {
synchronized (this) {
    if (!mOpen) {
      throw new RuntimeException("String_Node_Str");
    }
    int asset=openAsset(fileName,accessMode);
    if (asset != 0) {
      AssetInputStream res=new AssetInputStream(asset);
      incRefsLocked(res.hashCode());
      return res;
    }
  }
  throw new FileNotFoundException("String_Node_Str" + fileName);
}
Program: 23022
Project: 23022
Buggy source:
private void decOpenCountLocked(){
  mOpenCount--;
  if (mOpenCount == 0) {
    nativeDestroy(mNative);
    if (mAssets != null) {
      mAssets.xmlBlockGone();
    }
  }
}

Fixed version (ground truth):
private void decOpenCountLocked(){
  mOpenCount--;
  if (mOpenCount == 0) {
    nativeDestroy(mNative);
    if (mAssets != null) {
      mAssets.xmlBlockGone(hashCode());
    }
  }
}
Program: 23023
Project: 23023
Buggy source:
public static final void installSystemProviders(){
  ProcessRecord app=mSelf.mProcessNames.get("String_Node_Str",Process.SYSTEM_UID);
  List providers=mSelf.generateApplicationProvidersLocked(app);
  mSystemThread.installSystemProviders(providers);
}

Fixed version (ground truth):
public static final void installSystemProviders(){
  ProcessRecord app=mSelf.mProcessNames.get("String_Node_Str",Process.SYSTEM_UID);
  List providers=mSelf.generateApplicationProvidersLocked(app);
  if (providers != null) {
    for (int i=providers.size() - 1; i >= 0; i--) {
      ProviderInfo pi=(ProviderInfo)providers.get(i);
      if ((pi.applicationInfo.flags & ApplicationInfo.FLAG_SYSTEM) == 0) {
        Log.w(TAG,"String_Node_Str" + pi.name + "String_Node_Str");
        providers.remove(i);
      }
    }
  }
  mSystemThread.installSystemProviders(providers);
}