nus-yam/ex-repair huggingface dataset:
Program: 13935
Project: 13935
Buggy source:
public static MediaFile fromMediaModel(MediaModel media){
  if (media == null) {
    return null;
  }
  MediaFile mediaFile=new MediaFile();
  mediaFile.setBlogId(String.valueOf(media.getLocalSiteId()));
  mediaFile.setMediaId(String.valueOf(media.getMediaId()));
  mediaFile.setId(media.getId());
  mediaFile.setFileName(media.getFileName());
  mediaFile.setFilePath(media.getFilePath());
  mediaFile.setMimeType(media.getMimeType());
  mediaFile.setThumbnailURL(media.getThumbnailUrl());
  mediaFile.setFileURL(media.getUrl());
  mediaFile.setTitle(media.getTitle());
  mediaFile.setDescription(media.getDescription());
  mediaFile.setCaption(media.getCaption());
  mediaFile.setUploadState(media.getUploadState());
  return mediaFile;
}

Fixed version (ground truth):
public static MediaFile fromMediaModel(MediaModel media){
  if (media == null) {
    return null;
  }
  MediaFile mediaFile=new MediaFile();
  mediaFile.setBlogId(String.valueOf(media.getLocalSiteId()));
  mediaFile.setMediaId(String.valueOf(media.getMediaId()));
  mediaFile.setId(media.getId());
  mediaFile.setFileName(media.getFileName());
  mediaFile.setFilePath(media.getFilePath());
  mediaFile.setMimeType(media.getMimeType());
  mediaFile.setThumbnailURL(media.getThumbnailUrl());
  mediaFile.setFileURL(media.getUrl());
  mediaFile.setTitle(media.getTitle());
  mediaFile.setDescription(media.getDescription());
  mediaFile.setCaption(media.getCaption());
  mediaFile.setUploadState(media.getUploadState());
  mediaFile.setVideo(org.wordpress.android.fluxc.utils.MediaUtils.isVideoMimeType(media.getMimeType()));
  mediaFile.setVideoPressShortCode(ShortcodeUtils.getVideoPressShortcodeFromId(media.getVideoPressGuid()));
  return mediaFile;
}
Program: 13936
Project: 13936
Buggy source:
public static MediaModel fromMediaFile(MediaFile file){
  if (file == null) {
    return null;
  }
  MediaModel mediaModel=new MediaModel();
  mediaModel.setFileName(file.getFileName());
  mediaModel.setFilePath(file.getFilePath());
  mediaModel.setFileExtension(org.wordpress.android.fluxc.utils.MediaUtils.getExtension(file.getFilePath()));
  mediaModel.setMimeType(file.getMimeType());
  mediaModel.setThumbnailUrl(file.getThumbnailURL());
  mediaModel.setUrl(file.getFileURL());
  mediaModel.setTitle(file.getTitle());
  mediaModel.setDescription(file.getDescription());
  mediaModel.setCaption(file.getCaption());
  mediaModel.setMediaId(Long.valueOf(file.getMediaId()));
  mediaModel.setId(file.getId());
  mediaModel.setUploadState(file.getUploadState());
  mediaModel.setLocalSiteId(Integer.valueOf(file.getBlogId()));
  return mediaModel;
}

Fixed version (ground truth):
public static MediaModel fromMediaFile(MediaFile file){
  if (file == null) {
    return null;
  }
  MediaModel mediaModel=new MediaModel();
  mediaModel.setFileName(file.getFileName());
  mediaModel.setFilePath(file.getFilePath());
  mediaModel.setFileExtension(org.wordpress.android.fluxc.utils.MediaUtils.getExtension(file.getFilePath()));
  mediaModel.setMimeType(file.getMimeType());
  mediaModel.setThumbnailUrl(file.getThumbnailURL());
  mediaModel.setUrl(file.getFileURL());
  mediaModel.setTitle(file.getTitle());
  mediaModel.setDescription(file.getDescription());
  mediaModel.setCaption(file.getCaption());
  mediaModel.setMediaId(Long.valueOf(file.getMediaId()));
  mediaModel.setId(file.getId());
  mediaModel.setUploadState(file.getUploadState());
  mediaModel.setLocalSiteId(Integer.valueOf(file.getBlogId()));
  mediaModel.setVideoPressGuid(ShortcodeUtils.getVideoPressIdFromShortCode(file.getVideoPressShortCode()));
  return mediaModel;
}
Program: 13937
Project: 13937
Buggy source:
@Override public void onReceive(Context context,Intent intent){
  super.onReceive(context,intent);
  ((WordPress)context.getApplicationContext()).component().inject(this);
}

Fixed version (ground truth):
@Override public void onReceive(Context context,Intent intent){
  ((WordPress)context.getApplicationContext()).component().inject(this);
  super.onReceive(context,intent);
}
Program: 13938
Project: 13938
Buggy source:
@SuppressWarnings("String_Node_Str") @Subscribe(threadMode=ThreadMode.MAIN) public void onSiteChanged(OnSiteChanged event){
  if (!isFinishing()) {
    getAdapter().loadSites();
  }
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") @Subscribe(threadMode=ThreadMode.MAIN) public void onSiteChanged(OnSiteChanged event){
  mDebouncer.debounce(Void.class,new Runnable(){
    @Override public void run(){
      if (!isFinishing()) {
        getAdapter().loadSites();
      }
    }
  }
,200,TimeUnit.MILLISECONDS);
}
Program: 13939
Project: 13939
Buggy source:
@Override protected void onStart(){
  super.onStart();
}

Fixed version (ground truth):
@Override protected void onStart(){
  super.onStart();
  mDispatcher.register(this);
}
Program: 13940
Project: 13940
Buggy source:
@Override protected void onStop(){
  super.onStop();
}

Fixed version (ground truth):
@Override protected void onStop(){
  mDispatcher.unregister(this);
  super.onStop();
}
Program: 13941
Project: 13941
Buggy source:
void loadSites(){
  if (mIsTaskRunning) {
    AppLog.w(AppLog.T.UTILS,"String_Node_Str");
  }
 else {
    new LoadSitesTask().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
  }
}

Fixed version (ground truth):
void loadSites(){
  new LoadSitesTask().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
Program: 13942
Project: 13942
Buggy source:
void setVisibilityForSelectedSites(boolean makeVisible){
  SiteList sites=getSelectedSites();
  if (sites != null && sites.size() > 0) {
    for (    SiteRecord site : sites) {
      int index=mSites.indexOfSite(site);
      if (index > -1) {
        mSites.get(index).isHidden=!makeVisible;
      }
    }
  }
}

Fixed version (ground truth):
void setVisibilityForSelectedSites(boolean makeVisible){
  SiteList sites=getSelectedSites();
  if (sites != null && sites.size() > 0) {
    for (    SiteRecord site : sites) {
      int index=mAllSites.indexOfSite(site);
      if (index > -1) {
        mAllSites.get(index).isHidden=!makeVisible;
      }
    }
  }
  notifyDataSetChanged();
}
Program: 13943
Project: 13943
Buggy source:
void setEnableEditMode(boolean enable){
  if (mIsMultiSelectEnabled == enable)   return;
  if (enable) {
    mShowHiddenSites=true;
    mShowSelfHostedSites=false;
  }
 else {
    mShowHiddenSites=false;
    mShowSelfHostedSites=true;
  }
  mIsMultiSelectEnabled=enable;
  mSelectedPositions.clear();
  loadSites();
}

Fixed version (ground truth):
void setEnableEditMode(boolean enable){
  if (mIsMultiSelectEnabled == enable)   return;
  if (enable) {
    mShowHiddenSites=true;
    mShowSelfHostedSites=false;
  }
 else {
    mShowHiddenSites=false;
    mShowSelfHostedSites=true;
  }
  mIsMultiSelectEnabled=enable;
  mSelectedPositions.clear();
  if (enable) {
    loadSites();
  }
}
Program: 13945
Project: 13945
Buggy source:
private void startMediaUploadService(ArrayList<MediaModel> mediaToUpload){
  if (mUploadService != null) {
    if (mediaToUpload != null && !mediaToUpload.isEmpty()) {
      for (      MediaModel media : mediaToUpload) {
        mUploadService.addMediaToQueue(media);
      }
    }
  }
 else   if (NetworkUtils.isNetworkAvailable(this)) {
    Intent intent=new Intent(this,MediaUploadService.class);
    intent.putExtra(MediaUploadService.SITE_KEY,mSite);
    if (mediaToUpload != null) {
      intent.putExtra(MediaUploadService.MEDIA_LIST_KEY,mediaToUpload);
      bindService(intent,mUploadConnection,Context.BIND_AUTO_CREATE | Context.BIND_ABOVE_CLIENT);
    }
    startService(intent);
  }
}

Fixed version (ground truth):
private void startMediaUploadService(ArrayList<MediaModel> mediaToUpload){
  if (mUploadService != null) {
    if (mediaToUpload != null && !mediaToUpload.isEmpty()) {
      for (      MediaModel media : mediaToUpload) {
        mUploadService.addMediaToQueue(media);
      }
    }
  }
 else   if (NetworkUtils.isNetworkAvailable(this)) {
    Intent intent=new Intent(this,MediaUploadService.class);
    intent.putExtra(MediaUploadService.SITE_KEY,mSite);
    if (mediaToUpload != null) {
      intent.putExtra(MediaUploadService.MEDIA_LIST_KEY,mediaToUpload.toArray());
      bindService(intent,mUploadConnection,Context.BIND_AUTO_CREATE | Context.BIND_ABOVE_CLIENT);
    }
    startService(intent);
  }
}
Program: 13946
Project: 13946
Buggy source:
private void queueFileForUpload(Uri uri,String mimetype){
  String path=getRealPathFromURI(uri);
  if (path == null || path.equals("String_Node_Str")) {
    Toast.makeText(this,"String_Node_Str",Toast.LENGTH_SHORT).show();
    return;
  }
  File file=new File(path);
  if (!file.exists()) {
    return;
  }
  MediaModel currentUpload=new MediaModel();
  String filename=org.wordpress.android.fluxc.utils.MediaUtils.getFileName(path);
  currentUpload.setFileName(filename);
  currentUpload.setFilePath(path);
  if (mimetype == null) {
    mimetype=getContentResolver().getType(uri);
    String fileExtension=org.wordpress.android.fluxc.utils.MediaUtils.getExtension(path);
    if (mimetype == null) {
      mimetype=MimeTypeMap.getSingleton().getMimeTypeFromExtension(fileExtension);
    }
    if (mimetype == null) {
      mimetype="String_Node_Str";
    }
  }
  currentUpload.setMimeType(mimetype);
  addMediaToUploadService(currentUpload);
  MediaModel media=new MediaModel();
  String extension=org.wordpress.android.fluxc.utils.MediaUtils.getExtension(path);
  String mimeType=org.wordpress.android.fluxc.utils.MediaUtils.getMimeTypeForExtension(extension);
  media.setFilePath(path);
  media.setSiteId(mSite.getSiteId());
  media.setFileExtension(extension);
  media.setMimeType(mimeType);
  media.setUploadState(MediaUploadState.QUEUED.toString());
  addMediaToUploadService(media);
}

Fixed version (ground truth):
private void queueFileForUpload(Uri uri,String mimeType){
  String path=getRealPathFromURI(uri);
  if (path == null || path.equals("String_Node_Str")) {
    Toast.makeText(this,"String_Node_Str",Toast.LENGTH_SHORT).show();
    return;
  }
  File file=new File(path);
  if (!file.exists()) {
    return;
  }
  MediaModel media=new MediaModel();
  String filename=org.wordpress.android.fluxc.utils.MediaUtils.getFileName(path);
  String fileExtension=org.wordpress.android.fluxc.utils.MediaUtils.getExtension(path);
  if (mimeType == null) {
    mimeType=getContentResolver().getType(uri);
    if (mimeType == null) {
      mimeType=MimeTypeMap.getSingleton().getMimeTypeFromExtension(fileExtension);
    }
    if (mimeType == null) {
      mimeType="String_Node_Str";
    }
  }
  if (fileExtension == null) {
    fileExtension=MimeTypeMap.getSingleton().getExtensionFromMimeType(mimeType);
    filename+="String_Node_Str" + fileExtension;
  }
  media.setFileName(filename);
  media.setFilePath(path);
  media.setSiteId(mSite.getSiteId());
  media.setFileExtension(fileExtension);
  media.setMimeType(mimeType);
  media.setUploadState(MediaUploadState.QUEUED.toString());
  addMediaToUploadService(media);
}
Program: 13947
Project: 13947
Buggy source:
private static List<SiteModel> getSelfHostedSitesFromDeprecatedDB(Context context){
  List<SiteModel> siteList=new ArrayList<>();
  try {
    SQLiteDatabase db=context.getApplicationContext().openOrCreateDatabase(DEPRECATED_DATABASE_NAME,0,null);
    String[] fields=new String[]{"String_Node_Str","String_Node_Str","String_Node_Str"};
    String byString="String_Node_Str";
    Cursor c=db.query(DEPRECATED_BLOGS_TABLE,fields,byString,null,null,null,null);
    int numRows=c.getCount();
    c.moveToFirst();
    for (int i=0; i < numRows; i++) {
      SiteModel siteModel=new SiteModel();
      siteModel.setUsername(c.getString(0));
      siteModel.setPassword(c.getString(1));
      siteModel.setXmlRpcUrl(c.getString(2));
      siteList.add(siteModel);
      c.moveToNext();
    }
    c.close();
  }
 catch (  SQLException e) {
  }
  return siteList;
}

Fixed version (ground truth):
private static List<SiteModel> getSelfHostedSitesFromDeprecatedDB(Context context){
  List<SiteModel> siteList=new ArrayList<>();
  try {
    SQLiteDatabase db=context.getApplicationContext().openOrCreateDatabase(DEPRECATED_DATABASE_NAME,0,null);
    String[] fields=new String[]{"String_Node_Str","String_Node_Str","String_Node_Str"};
    String encryptedEmptyPassword="String_Node_Str";
    String byString=String.format("String_Node_Str",encryptedEmptyPassword);
    Cursor c=db.query(DEPRECATED_BLOGS_TABLE,fields,byString,null,null,null,null);
    int numRows=c.getCount();
    c.moveToFirst();
    for (int i=0; i < numRows; i++) {
      SiteModel siteModel=new SiteModel();
      siteModel.setUsername(c.getString(0));
      siteModel.setPassword(c.getString(1));
      siteModel.setXmlRpcUrl(c.getString(2));
      siteList.add(siteModel);
      c.moveToNext();
    }
    c.close();
  }
 catch (  SQLException e) {
  }
  return siteList;
}
Program: 13948
Project: 13948
Buggy source:
@Override public void onStart(){
  super.onStart();
  mDispatcher.register(this);
  EventBus.getDefault().register(this);
}

Fixed version (ground truth):
@Override public void onStart(){
  super.onStart();
  EventBus.getDefault().register(this);
}
Program: 13950
Project: 13950
Buggy source:
/** 
 * Checks if two posts have differing data
 */
public static boolean postHasEdits(PostModel oldPost,PostModel newPost){
  if (oldPost == null) {
    return newPost != null;
  }
  return newPost == null || !(StringUtils.equals(oldPost.getTitle(),newPost.getTitle()) && StringUtils.equals(oldPost.getContent(),newPost.getContent()) && StringUtils.equals(oldPost.getExcerpt(),newPost.getExcerpt())&& StringUtils.equals(oldPost.getStatus(),newPost.getStatus())&& StringUtils.equals(oldPost.getPassword(),newPost.getPassword())&& StringUtils.equals(oldPost.getPostFormat(),newPost.getPostFormat())&& StringUtils.equals(oldPost.getDateCreated(),newPost.getDateCreated())&& oldPost.getTagIdList().containsAll(newPost.getTagIdList())&& newPost.getTagIdList().containsAll(oldPost.getTagIdList())&& oldPost.getCategoryIdList().containsAll(newPost.getCategoryIdList())&& newPost.getCategoryIdList().containsAll(oldPost.getCategoryIdList())&& PostLocation.equals(oldPost.getLocation(),newPost.getLocation()));
}

Fixed version (ground truth):
/** 
 * Checks if two posts have differing data
 */
public static boolean postHasEdits(PostModel oldPost,PostModel newPost){
  if (oldPost == null) {
    return newPost != null;
  }
  return newPost == null || !(StringUtils.equals(oldPost.getTitle(),newPost.getTitle()) && StringUtils.equals(oldPost.getContent(),newPost.getContent()) && StringUtils.equals(oldPost.getExcerpt(),newPost.getExcerpt())&& StringUtils.equals(oldPost.getStatus(),newPost.getStatus())&& StringUtils.equals(oldPost.getPassword(),newPost.getPassword())&& StringUtils.equals(oldPost.getPostFormat(),newPost.getPostFormat())&& StringUtils.equals(oldPost.getDateCreated(),newPost.getDateCreated())&& oldPost.getTagNameList().containsAll(newPost.getTagNameList())&& newPost.getTagNameList().containsAll(oldPost.getTagNameList())&& oldPost.getCategoryIdList().containsAll(newPost.getCategoryIdList())&& newPost.getCategoryIdList().containsAll(oldPost.getCategoryIdList())&& PostLocation.equals(oldPost.getLocation(),newPost.getLocation()));
}
Program: 13951
Project: 13951
Buggy source:
private void trackUploadAnalytics(){
  Map<String,Object> properties=new HashMap<>();
  properties.put("String_Node_Str",AnalyticsUtils.getWordCount(mPost.getContent()));
  if (hasGallery()) {
    properties.put("String_Node_Str",true);
  }
  if (mHasImage) {
    properties.put("String_Node_Str",true);
  }
  if (mHasVideo) {
    properties.put("String_Node_Str",true);
  }
  if (mHasCategory) {
    properties.put("String_Node_Str",true);
  }
  if (!mPost.getTagIdList().isEmpty()) {
    properties.put("String_Node_Str",true);
  }
  properties.put("String_Node_Str",AppPrefs.isVisualEditorEnabled());
  AnalyticsUtils.trackWithSiteDetails(Stat.EDITOR_PUBLISHED_POST,mSite,properties);
}

Fixed version (ground truth):
private void trackUploadAnalytics(){
  Map<String,Object> properties=new HashMap<>();
  properties.put("String_Node_Str",AnalyticsUtils.getWordCount(mPost.getContent()));
  if (hasGallery()) {
    properties.put("String_Node_Str",true);
  }
  if (mHasImage) {
    properties.put("String_Node_Str",true);
  }
  if (mHasVideo) {
    properties.put("String_Node_Str",true);
  }
  if (mHasCategory) {
    properties.put("String_Node_Str",true);
  }
  if (!mPost.getTagNameList().isEmpty()) {
    properties.put("String_Node_Str",true);
  }
  properties.put("String_Node_Str",AppPrefs.isVisualEditorEnabled());
  AnalyticsUtils.trackWithSiteDetails(Stat.EDITOR_PUBLISHED_POST,mSite,properties);
}
Program: 13952
Project: 13952
Buggy source:
@Override public void onCreate(){
  super.onCreate();
  long startDate=SystemClock.elapsedRealtime();
  mContext=this;
  ProfilingUtils.start("String_Node_Str");
  AppLog.enableRecording(true);
  AppLog.i(T.UTILS,"String_Node_Str");
  if (!PackageUtils.isDebugBuild()) {
    Fabric.with(this,new Crashlytics());
  }
  versionName=PackageUtils.getVersionName(this);
  initWpDb();
  enableHttpResponseCache(mContext);
  EventBus.TAG="String_Node_Str";
  EventBus.builder().logNoSubscriberMessages(false).sendNoSubscriberEvent(false).throwSubscriberException(true).installDefaultEventBus();
  EventBus.getDefault().register(this);
  RestClientUtils.setUserAgent(getUserAgent());
  setupVolleyQueue();
  if (!AppLockManager.getInstance().isAppLockFeatureEnabled()) {
    AppLockManager.getInstance().enableDefaultAppLockIfAvailable(this);
  }
  if (AppLockManager.getInstance().isAppLockFeatureEnabled()) {
    AppLockManager.getInstance().getAppLock().setExemptActivities(new String[]{"String_Node_Str"});
  }
  HelpshiftHelper.init(this);
  ApplicationLifecycleMonitor applicationLifecycleMonitor=new ApplicationLifecycleMonitor();
  registerComponentCallbacks(applicationLifecycleMonitor);
  registerActivityLifecycleCallbacks(applicationLifecycleMonitor);
  initAnalytics(SystemClock.elapsedRealtime() - startDate);
  WPActivityUtils.applyLocale(getContext());
}

Fixed version (ground truth):
@Override public void onCreate(){
  super.onCreate();
  long startDate=SystemClock.elapsedRealtime();
  mContext=this;
  ProfilingUtils.start("String_Node_Str");
  AppLog.enableRecording(true);
  AppLog.i(T.UTILS,"String_Node_Str");
  if (!PackageUtils.isDebugBuild()) {
    Fabric.with(this,new Crashlytics());
  }
  versionName=PackageUtils.getVersionName(this);
  initWpDb();
  enableHttpResponseCache(mContext);
  EventBus.TAG="String_Node_Str";
  EventBus.builder().logNoSubscriberMessages(false).sendNoSubscriberEvent(false).throwSubscriberException(true).installDefaultEventBus();
  EventBus.getDefault().register(this);
  RestClientUtils.setUserAgent(getUserAgent());
  setupVolleyQueue();
  if (!AppLockManager.getInstance().isAppLockFeatureEnabled()) {
    AppLockManager.getInstance().enableDefaultAppLockIfAvailable(this);
  }
  if (AppLockManager.getInstance().isAppLockFeatureEnabled()) {
    AppLockManager.getInstance().getAppLock().setExemptActivities(new String[]{"String_Node_Str"});
  }
  HelpshiftHelper.init(this);
  ApplicationLifecycleMonitor applicationLifecycleMonitor=new ApplicationLifecycleMonitor();
  registerComponentCallbacks(applicationLifecycleMonitor);
  registerActivityLifecycleCallbacks(applicationLifecycleMonitor);
  initAnalytics(SystemClock.elapsedRealtime() - startDate);
  WPActivityUtils.applyLocale(getContext());
  AppCompatDelegate.setCompatVectorFromResourcesEnabled(true);
}
Program: 13953
Project: 13953
Buggy source:
private synchronized void updatePostObject(boolean isAutosave){
  if (mPost == null) {
    AppLog.e(AppLog.T.POSTS,"String_Node_Str");
    return;
  }
  if (mEditorFragment != null) {
    if (mShowNewEditor) {
      updatePostContentNewEditor(isAutosave,(String)mEditorFragment.getTitle(),(String)mEditorFragment.getContent());
    }
 else {
      updatePostContent(isAutosave);
    }
  }
  if (mEditPostSettingsFragment != null) {
    mEditPostSettingsFragment.updatePostSettings();
  }
}

Fixed version (ground truth):
private synchronized void updatePostObject(boolean isAutosave) throws IllegalEditorStateException {
  if (mPost == null) {
    AppLog.e(AppLog.T.POSTS,"String_Node_Str");
    return;
  }
  if (mEditorFragment != null) {
    if (mShowNewEditor) {
      updatePostContentNewEditor(isAutosave,(String)mEditorFragment.getTitle(),(String)mEditorFragment.getContent());
    }
 else {
      updatePostContent(isAutosave);
    }
  }
  if (mEditPostSettingsFragment != null) {
    mEditPostSettingsFragment.updatePostSettings();
  }
}
Program: 13954
Project: 13954
Buggy source:
private void savePostAsync(final AfterSavePostListener listener){
  new Thread(new Runnable(){
    @Override public void run(){
      updatePostObject(false);
      savePostToDb();
      if (listener != null) {
        listener.onPostSave();
      }
    }
  }
).start();
}

Fixed version (ground truth):
private void savePostAsync(final AfterSavePostListener listener){
  new Thread(new Runnable(){
    @Override public void run(){
      try {
        updatePostObject(false);
      }
 catch (      IllegalEditorStateException e) {
        AppLog.e(T.EDITOR,"String_Node_Str");
        return;
      }
      savePostToDb();
      if (listener != null) {
        listener.onPostSave();
      }
    }
  }
).start();
}
Program: 13955
Project: 13955
Buggy source:
private boolean publishPost(){
  if (!NetworkUtils.isNetworkAvailable(this)) {
    ToastUtils.showToast(this,R.string.error_publish_no_network,Duration.SHORT);
    return false;
  }
  if (mEditorFragment.hasFailedMediaUploads()) {
    AlertDialog.Builder builder=new AlertDialog.Builder(this);
    builder.setMessage(R.string.editor_toast_failed_uploads).setPositiveButton(R.string.editor_remove_failed_uploads,new DialogInterface.OnClickListener(){
      public void onClick(      DialogInterface dialog,      int id){
        mEditorFragment.removeAllFailedMediaUploads();
      }
    }
).setNegativeButton(android.R.string.cancel,null);
    builder.create().show();
    return true;
  }
  new Thread(new Runnable(){
    @Override public void run(){
      updatePostObject(false);
      savePostToDb();
      if (!mPost.isPublishable()) {
        mHandler.post(new Runnable(){
          @Override public void run(){
            ToastUtils.showToast(EditPostActivity.this,R.string.error_publish_empty_post,Duration.SHORT);
          }
        }
);
        return;
      }
      PostUtils.trackSavePostAnalytics(mPost);
      PostUploadService.addPostToUpload(mPost);
      PostUploadService.setLegacyMode(!mShowNewEditor);
      startService(new Intent(EditPostActivity.this,PostUploadService.class));
      setResult(RESULT_OK);
      finish();
    }
  }
).start();
  return true;
}

Fixed version (ground truth):
private boolean publishPost(){
  if (!NetworkUtils.isNetworkAvailable(this)) {
    ToastUtils.showToast(this,R.string.error_publish_no_network,Duration.SHORT);
    return false;
  }
  if (mEditorFragment.hasFailedMediaUploads()) {
    AlertDialog.Builder builder=new AlertDialog.Builder(this);
    builder.setMessage(R.string.editor_toast_failed_uploads).setPositiveButton(R.string.editor_remove_failed_uploads,new DialogInterface.OnClickListener(){
      public void onClick(      DialogInterface dialog,      int id){
        mEditorFragment.removeAllFailedMediaUploads();
      }
    }
).setNegativeButton(android.R.string.cancel,null);
    builder.create().show();
    return true;
  }
  new Thread(new Runnable(){
    @Override public void run(){
      try {
        updatePostObject(false);
      }
 catch (      IllegalEditorStateException e) {
        AppLog.e(T.EDITOR,"String_Node_Str");
        return;
      }
      savePostToDb();
      if (!mPost.isPublishable()) {
        mHandler.post(new Runnable(){
          @Override public void run(){
            ToastUtils.showToast(EditPostActivity.this,R.string.error_publish_empty_post,Duration.SHORT);
          }
        }
);
        return;
      }
      PostUtils.trackSavePostAnalytics(mPost);
      PostUploadService.addPostToUpload(mPost);
      PostUploadService.setLegacyMode(!mShowNewEditor);
      startService(new Intent(EditPostActivity.this,PostUploadService.class));
      setResult(RESULT_OK);
      finish();
    }
  }
).start();
  return true;
}
Program: 13957
Project: 13957
Buggy source:
private void handleGalleryImageUploadedLegacyEditor(Long galleryId,String localId,String remoteId){
  SpannableStringBuilder postContent;
  if (mEditorFragment.getSpannedContent() != null) {
    postContent=new SpannableStringBuilder(mEditorFragment.getSpannedContent());
  }
 else {
    postContent=new SpannableStringBuilder(StringUtils.notNullStr((String)mEditorFragment.getContent()));
  }
  int selectionStart=0;
  int selectionEnd=postContent.length();
  MediaGalleryImageSpan[] gallerySpans=postContent.getSpans(selectionStart,selectionEnd,MediaGalleryImageSpan.class);
  if (gallerySpans.length != 0) {
    for (    MediaGalleryImageSpan gallerySpan : gallerySpans) {
      MediaGallery gallery=gallerySpan.getMediaGallery();
      if (gallery.getUniqueId() == galleryId) {
        ArrayList<String> galleryIds=gallery.getIds();
        galleryIds.add(remoteId);
        gallery.setIds(galleryIds);
        gallerySpan.setMediaGallery(gallery);
        int spanStart=postContent.getSpanStart(gallerySpan);
        int spanEnd=postContent.getSpanEnd(gallerySpan);
        postContent.setSpan(gallerySpan,spanStart,spanEnd,Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
      }
    }
  }
}

Fixed version (ground truth):
private void handleGalleryImageUploadedLegacyEditor(Long galleryId,String localId,String remoteId){
  SpannableStringBuilder postContent;
  if (mEditorFragment.getSpannedContent() != null) {
    postContent=new SpannableStringBuilder(mEditorFragment.getSpannedContent());
  }
 else {
    try {
      postContent=new SpannableStringBuilder(StringUtils.notNullStr((String)mEditorFragment.getContent()));
    }
 catch (    IllegalEditorStateException e) {
      AppLog.e(T.EDITOR,"String_Node_Str");
      return;
    }
  }
  int selectionStart=0;
  int selectionEnd=postContent.length();
  MediaGalleryImageSpan[] gallerySpans=postContent.getSpans(selectionStart,selectionEnd,MediaGalleryImageSpan.class);
  if (gallerySpans.length != 0) {
    for (    MediaGalleryImageSpan gallerySpan : gallerySpans) {
      MediaGallery gallery=gallerySpan.getMediaGallery();
      if (gallery.getUniqueId() == galleryId) {
        ArrayList<String> galleryIds=gallery.getIds();
        galleryIds.add(remoteId);
        gallery.setIds(galleryIds);
        gallerySpan.setMediaGallery(gallery);
        int spanStart=postContent.getSpanStart(gallerySpan);
        int spanEnd=postContent.getSpanEnd(gallerySpan);
        postContent.setSpan(gallerySpan,spanStart,spanEnd,Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
      }
    }
  }
}
Program: 13958
Project: 13958
Buggy source:
/** 
 * Returns the contents of the title field from the JavaScript editor. Should be called from a background thread where possible.
 */
@Override public CharSequence getTitle(){
  if (!isAdded()) {
    return "String_Node_Str";
  }
  if (mSourceView != null && mSourceView.getVisibility() == View.VISIBLE) {
    mTitle=mSourceViewTitle.getText().toString();
    return StringUtils.notNullStr(mTitle);
  }
  if (Looper.myLooper() == Looper.getMainLooper()) {
    AppLog.d(T.EDITOR,"String_Node_Str");
  }
  mGetTitleCountDownLatch=new CountDownLatch(1);
  getActivity().runOnUiThread(new Runnable(){
    @Override public void run(){
      mWebView.execJavaScriptFromString("String_Node_Str");
    }
  }
);
  try {
    mGetTitleCountDownLatch.await(1,TimeUnit.SECONDS);
  }
 catch (  InterruptedException e) {
    AppLog.e(T.EDITOR,e);
    Thread.currentThread().interrupt();
  }
  return StringUtils.notNullStr(mTitle.replaceAll("String_Node_Str","String_Node_Str"));
}

Fixed version (ground truth):
/** 
 * Returns the contents of the title field from the JavaScript editor. Should be called from a background thread where possible.
 */
@Override public CharSequence getTitle() throws IllegalEditorStateException {
  if (!isAdded()) {
    throw new IllegalEditorStateException();
  }
  if (mSourceView != null && mSourceView.getVisibility() == View.VISIBLE) {
    mTitle=mSourceViewTitle.getText().toString();
    return StringUtils.notNullStr(mTitle);
  }
  if (Looper.myLooper() == Looper.getMainLooper()) {
    AppLog.d(T.EDITOR,"String_Node_Str");
  }
  mGetTitleCountDownLatch=new CountDownLatch(1);
  getActivity().runOnUiThread(new Runnable(){
    @Override public void run(){
      mWebView.execJavaScriptFromString("String_Node_Str");
    }
  }
);
  try {
    mGetTitleCountDownLatch.await(1,TimeUnit.SECONDS);
  }
 catch (  InterruptedException e) {
    AppLog.e(T.EDITOR,e);
    Thread.currentThread().interrupt();
  }
  return StringUtils.notNullStr(mTitle.replaceAll("String_Node_Str","String_Node_Str"));
}
Program: 13959
Project: 13959
Buggy source:
/** 
 * Returns the contents of the content field from the JavaScript editor. Should be called from a background thread where possible.
 */
@Override public CharSequence getContent(){
  if (!isAdded()) {
    return "String_Node_Str";
  }
  if (mSourceView != null && mSourceView.getVisibility() == View.VISIBLE) {
    mContentHtml=mSourceViewContent.getText().toString();
    return StringUtils.notNullStr(mContentHtml);
  }
  if (Looper.myLooper() == Looper.getMainLooper()) {
    AppLog.d(T.EDITOR,"String_Node_Str");
  }
  mGetContentCountDownLatch=new CountDownLatch(1);
  getActivity().runOnUiThread(new Runnable(){
    @Override public void run(){
      mWebView.execJavaScriptFromString("String_Node_Str");
    }
  }
);
  try {
    mGetContentCountDownLatch.await(1,TimeUnit.SECONDS);
  }
 catch (  InterruptedException e) {
    AppLog.e(T.EDITOR,e);
    Thread.currentThread().interrupt();
  }
  return StringUtils.notNullStr(mContentHtml);
}

Fixed version (ground truth):
/** 
 * Returns the contents of the content field from the JavaScript editor. Should be called from a background thread where possible.
 */
@Override public CharSequence getContent() throws IllegalEditorStateException {
  if (!isAdded()) {
    throw new IllegalEditorStateException();
  }
  if (mSourceView != null && mSourceView.getVisibility() == View.VISIBLE) {
    mContentHtml=mSourceViewContent.getText().toString();
    return StringUtils.notNullStr(mContentHtml);
  }
  if (Looper.myLooper() == Looper.getMainLooper()) {
    AppLog.d(T.EDITOR,"String_Node_Str");
  }
  mGetContentCountDownLatch=new CountDownLatch(1);
  getActivity().runOnUiThread(new Runnable(){
    @Override public void run(){
      mWebView.execJavaScriptFromString("String_Node_Str");
    }
  }
);
  try {
    mGetContentCountDownLatch.await(1,TimeUnit.SECONDS);
  }
 catch (  InterruptedException e) {
    AppLog.e(T.EDITOR,e);
    Thread.currentThread().interrupt();
  }
  return StringUtils.notNullStr(mContentHtml);
}
Program: 13961
Project: 13961
Buggy source:
@Override public void onSaveInstanceState(Bundle outState){
  outState.putCharSequence(KEY_TITLE,getTitle());
  outState.putCharSequence(KEY_CONTENT,getContent());
}

Fixed version (ground truth):
@Override public void onSaveInstanceState(Bundle outState){
  try {
    outState.putCharSequence(KEY_TITLE,getTitle());
    outState.putCharSequence(KEY_CONTENT,getContent());
  }
 catch (  IllegalEditorStateException e) {
    AppLog.e(T.EDITOR,"String_Node_Str");
  }
}
Program: 13962
Project: 13962
Buggy source:
public abstract CharSequence getContent();

Fixed version (ground truth):
public abstract CharSequence getContent() throws IllegalEditorStateException ;
Program: 13963
Project: 13963
Buggy source:
public abstract CharSequence getTitle();

Fixed version (ground truth):
public abstract CharSequence getTitle() throws IllegalEditorStateException ;
Program: 13964
Project: 13964
Buggy source:
private synchronized void updatePostObject(boolean isAutosave){
  if (mPost == null) {
    AppLog.e(AppLog.T.POSTS,"String_Node_Str");
    return;
  }
  if (mEditorFragment != null) {
    if (mShowNewEditor) {
      updatePostContentNewEditor(isAutosave,(String)mEditorFragment.getTitle(),(String)mEditorFragment.getContent());
    }
 else {
      updatePostContent(isAutosave);
    }
  }
  if (mEditPostSettingsFragment != null) {
    mEditPostSettingsFragment.updatePostSettings();
  }
}

Fixed version (ground truth):
private synchronized void updatePostObject(boolean isAutosave) throws IllegalEditorStateException {
  if (mPost == null) {
    AppLog.e(AppLog.T.POSTS,"String_Node_Str");
    return;
  }
  if (mEditorFragment != null) {
    if (mShowNewEditor) {
      updatePostContentNewEditor(isAutosave,(String)mEditorFragment.getTitle(),(String)mEditorFragment.getContent());
    }
 else {
      updatePostContent(isAutosave);
    }
  }
  if (mEditPostSettingsFragment != null) {
    mEditPostSettingsFragment.updatePostSettings();
  }
}
Program: 13965
Project: 13965
Buggy source:
private void savePostAsync(final AfterSavePostListener listener){
  new Thread(new Runnable(){
    @Override public void run(){
      updatePostObject(false);
      savePostToDb();
      if (listener != null) {
        listener.onPostSave();
      }
    }
  }
).start();
}

Fixed version (ground truth):
private void savePostAsync(final AfterSavePostListener listener){
  new Thread(new Runnable(){
    @Override public void run(){
      try {
        updatePostObject(false);
      }
 catch (      IllegalEditorStateException e) {
        AppLog.e(T.EDITOR,"String_Node_Str");
        return;
      }
      savePostToDb();
      if (listener != null) {
        listener.onPostSave();
      }
    }
  }
).start();
}
Program: 13966
Project: 13966
Buggy source:
private boolean publishPost(){
  if (!NetworkUtils.isNetworkAvailable(this)) {
    ToastUtils.showToast(this,R.string.error_publish_no_network,Duration.SHORT);
    return false;
  }
  if (mEditorFragment.hasFailedMediaUploads()) {
    AlertDialog.Builder builder=new AlertDialog.Builder(this);
    builder.setMessage(R.string.editor_toast_failed_uploads).setPositiveButton(R.string.editor_remove_failed_uploads,new DialogInterface.OnClickListener(){
      public void onClick(      DialogInterface dialog,      int id){
        mEditorFragment.removeAllFailedMediaUploads();
      }
    }
).setNegativeButton(android.R.string.cancel,null);
    builder.create().show();
    return true;
  }
  new Thread(new Runnable(){
    @Override public void run(){
      updatePostObject(false);
      savePostToDb();
      if (!mPost.isPublishable()) {
        mHandler.post(new Runnable(){
          @Override public void run(){
            ToastUtils.showToast(EditPostActivity.this,R.string.error_publish_empty_post,Duration.SHORT);
          }
        }
);
        return;
      }
      PostUtils.trackSavePostAnalytics(mPost);
      PostUploadService.addPostToUpload(mPost);
      PostUploadService.setLegacyMode(!mShowNewEditor);
      startService(new Intent(EditPostActivity.this,PostUploadService.class));
      setResult(RESULT_OK);
      finish();
    }
  }
).start();
  return true;
}

Fixed version (ground truth):
private boolean publishPost(){
  if (!NetworkUtils.isNetworkAvailable(this)) {
    ToastUtils.showToast(this,R.string.error_publish_no_network,Duration.SHORT);
    return false;
  }
  if (mEditorFragment.hasFailedMediaUploads()) {
    AlertDialog.Builder builder=new AlertDialog.Builder(this);
    builder.setMessage(R.string.editor_toast_failed_uploads).setPositiveButton(R.string.editor_remove_failed_uploads,new DialogInterface.OnClickListener(){
      public void onClick(      DialogInterface dialog,      int id){
        mEditorFragment.removeAllFailedMediaUploads();
      }
    }
).setNegativeButton(android.R.string.cancel,null);
    builder.create().show();
    return true;
  }
  new Thread(new Runnable(){
    @Override public void run(){
      try {
        updatePostObject(false);
      }
 catch (      IllegalEditorStateException e) {
        AppLog.e(T.EDITOR,"String_Node_Str");
        return;
      }
      savePostToDb();
      if (!mPost.isPublishable()) {
        mHandler.post(new Runnable(){
          @Override public void run(){
            ToastUtils.showToast(EditPostActivity.this,R.string.error_publish_empty_post,Duration.SHORT);
          }
        }
);
        return;
      }
      PostUtils.trackSavePostAnalytics(mPost);
      PostUploadService.addPostToUpload(mPost);
      PostUploadService.setLegacyMode(!mShowNewEditor);
      startService(new Intent(EditPostActivity.this,PostUploadService.class));
      setResult(RESULT_OK);
      finish();
    }
  }
).start();
  return true;
}
Program: 13968
Project: 13968
Buggy source:
private void handleGalleryImageUploadedLegacyEditor(Long galleryId,String localId,String remoteId){
  SpannableStringBuilder postContent;
  if (mEditorFragment.getSpannedContent() != null) {
    postContent=new SpannableStringBuilder(mEditorFragment.getSpannedContent());
  }
 else {
    postContent=new SpannableStringBuilder(StringUtils.notNullStr((String)mEditorFragment.getContent()));
  }
  int selectionStart=0;
  int selectionEnd=postContent.length();
  MediaGalleryImageSpan[] gallerySpans=postContent.getSpans(selectionStart,selectionEnd,MediaGalleryImageSpan.class);
  if (gallerySpans.length != 0) {
    for (    MediaGalleryImageSpan gallerySpan : gallerySpans) {
      MediaGallery gallery=gallerySpan.getMediaGallery();
      if (gallery.getUniqueId() == galleryId) {
        ArrayList<String> galleryIds=gallery.getIds();
        galleryIds.add(remoteId);
        gallery.setIds(galleryIds);
        gallerySpan.setMediaGallery(gallery);
        int spanStart=postContent.getSpanStart(gallerySpan);
        int spanEnd=postContent.getSpanEnd(gallerySpan);
        postContent.setSpan(gallerySpan,spanStart,spanEnd,Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
      }
    }
  }
}

Fixed version (ground truth):
private void handleGalleryImageUploadedLegacyEditor(Long galleryId,String localId,String remoteId){
  SpannableStringBuilder postContent;
  if (mEditorFragment.getSpannedContent() != null) {
    postContent=new SpannableStringBuilder(mEditorFragment.getSpannedContent());
  }
 else {
    try {
      postContent=new SpannableStringBuilder(StringUtils.notNullStr((String)mEditorFragment.getContent()));
    }
 catch (    IllegalEditorStateException e) {
      AppLog.e(T.EDITOR,"String_Node_Str");
      return;
    }
  }
  int selectionStart=0;
  int selectionEnd=postContent.length();
  MediaGalleryImageSpan[] gallerySpans=postContent.getSpans(selectionStart,selectionEnd,MediaGalleryImageSpan.class);
  if (gallerySpans.length != 0) {
    for (    MediaGalleryImageSpan gallerySpan : gallerySpans) {
      MediaGallery gallery=gallerySpan.getMediaGallery();
      if (gallery.getUniqueId() == galleryId) {
        ArrayList<String> galleryIds=gallery.getIds();
        galleryIds.add(remoteId);
        gallery.setIds(galleryIds);
        gallerySpan.setMediaGallery(gallery);
        int spanStart=postContent.getSpanStart(gallerySpan);
        int spanEnd=postContent.getSpanEnd(gallerySpan);
        postContent.setSpan(gallerySpan,spanStart,spanEnd,Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
      }
    }
  }
}
Program: 13969
Project: 13969
Buggy source:
/** 
 * Returns the contents of the title field from the JavaScript editor. Should be called from a background thread where possible.
 */
@Override public CharSequence getTitle(){
  if (!isAdded()) {
    return "String_Node_Str";
  }
  if (mSourceView != null && mSourceView.getVisibility() == View.VISIBLE) {
    mTitle=mSourceViewTitle.getText().toString();
    return StringUtils.notNullStr(mTitle);
  }
  if (Looper.myLooper() == Looper.getMainLooper()) {
    AppLog.d(T.EDITOR,"String_Node_Str");
  }
  mGetTitleCountDownLatch=new CountDownLatch(1);
  getActivity().runOnUiThread(new Runnable(){
    @Override public void run(){
      mWebView.execJavaScriptFromString("String_Node_Str");
    }
  }
);
  try {
    mGetTitleCountDownLatch.await(1,TimeUnit.SECONDS);
  }
 catch (  InterruptedException e) {
    AppLog.e(T.EDITOR,e);
    Thread.currentThread().interrupt();
  }
  return StringUtils.notNullStr(mTitle.replaceAll("String_Node_Str","String_Node_Str"));
}

Fixed version (ground truth):
/** 
 * Returns the contents of the title field from the JavaScript editor. Should be called from a background thread where possible.
 */
@Override public CharSequence getTitle() throws IllegalEditorStateException {
  if (!isAdded()) {
    throw new IllegalEditorStateException();
  }
  if (mSourceView != null && mSourceView.getVisibility() == View.VISIBLE) {
    mTitle=mSourceViewTitle.getText().toString();
    return StringUtils.notNullStr(mTitle);
  }
  if (Looper.myLooper() == Looper.getMainLooper()) {
    AppLog.d(T.EDITOR,"String_Node_Str");
  }
  mGetTitleCountDownLatch=new CountDownLatch(1);
  getActivity().runOnUiThread(new Runnable(){
    @Override public void run(){
      mWebView.execJavaScriptFromString("String_Node_Str");
    }
  }
);
  try {
    mGetTitleCountDownLatch.await(1,TimeUnit.SECONDS);
  }
 catch (  InterruptedException e) {
    AppLog.e(T.EDITOR,e);
    Thread.currentThread().interrupt();
  }
  return StringUtils.notNullStr(mTitle.replaceAll("String_Node_Str","String_Node_Str"));
}
Program: 13970
Project: 13970
Buggy source:
/** 
 * Returns the contents of the content field from the JavaScript editor. Should be called from a background thread where possible.
 */
@Override public CharSequence getContent(){
  if (!isAdded()) {
    return "String_Node_Str";
  }
  if (mSourceView != null && mSourceView.getVisibility() == View.VISIBLE) {
    mContentHtml=mSourceViewContent.getText().toString();
    return StringUtils.notNullStr(mContentHtml);
  }
  if (Looper.myLooper() == Looper.getMainLooper()) {
    AppLog.d(T.EDITOR,"String_Node_Str");
  }
  mGetContentCountDownLatch=new CountDownLatch(1);
  getActivity().runOnUiThread(new Runnable(){
    @Override public void run(){
      mWebView.execJavaScriptFromString("String_Node_Str");
    }
  }
);
  try {
    mGetContentCountDownLatch.await(1,TimeUnit.SECONDS);
  }
 catch (  InterruptedException e) {
    AppLog.e(T.EDITOR,e);
    Thread.currentThread().interrupt();
  }
  return StringUtils.notNullStr(mContentHtml);
}

Fixed version (ground truth):
/** 
 * Returns the contents of the content field from the JavaScript editor. Should be called from a background thread where possible.
 */
@Override public CharSequence getContent() throws IllegalEditorStateException {
  if (!isAdded()) {
    throw new IllegalEditorStateException();
  }
  if (mSourceView != null && mSourceView.getVisibility() == View.VISIBLE) {
    mContentHtml=mSourceViewContent.getText().toString();
    return StringUtils.notNullStr(mContentHtml);
  }
  if (Looper.myLooper() == Looper.getMainLooper()) {
    AppLog.d(T.EDITOR,"String_Node_Str");
  }
  mGetContentCountDownLatch=new CountDownLatch(1);
  getActivity().runOnUiThread(new Runnable(){
    @Override public void run(){
      mWebView.execJavaScriptFromString("String_Node_Str");
    }
  }
);
  try {
    mGetContentCountDownLatch.await(1,TimeUnit.SECONDS);
  }
 catch (  InterruptedException e) {
    AppLog.e(T.EDITOR,e);
    Thread.currentThread().interrupt();
  }
  return StringUtils.notNullStr(mContentHtml);
}
Program: 13972
Project: 13972
Buggy source:
@Override public void onSaveInstanceState(Bundle outState){
  outState.putCharSequence(KEY_TITLE,getTitle());
  outState.putCharSequence(KEY_CONTENT,getContent());
}

Fixed version (ground truth):
@Override public void onSaveInstanceState(Bundle outState){
  try {
    outState.putCharSequence(KEY_TITLE,getTitle());
    outState.putCharSequence(KEY_CONTENT,getContent());
  }
 catch (  IllegalEditorStateException e) {
    AppLog.e(T.EDITOR,"String_Node_Str");
  }
}
Program: 13973
Project: 13973
Buggy source:
public abstract CharSequence getContent();

Fixed version (ground truth):
public abstract CharSequence getContent() throws IllegalEditorStateException ;
Program: 13974
Project: 13974
Buggy source:
public abstract CharSequence getTitle();

Fixed version (ground truth):
public abstract CharSequence getTitle() throws IllegalEditorStateException ;
Program: 13975
Project: 13975
Buggy source:
@Override public boolean onMenuItemActionCollapse(MenuItem item){
  configureBlogsSettings(mBlogsCategory,false);
  return true;
}

Fixed version (ground truth):
@Override public boolean onMenuItemActionCollapse(MenuItem item){
  mSearchMenuItemCollapsed=true;
  configureBlogsSettings(mBlogsCategory,false);
  return true;
}
Program: 13976
Project: 13976
Buggy source:
@Override public boolean onMenuItemActionExpand(MenuItem item){
  configureBlogsSettings(mBlogsCategory,true);
  return true;
}

Fixed version (ground truth):
@Override public boolean onMenuItemActionExpand(MenuItem item){
  mSearchMenuItemCollapsed=false;
  configureBlogsSettings(mBlogsCategory,true);
  return true;
}
Program: 13977
Project: 13977
Buggy source:
@Override public boolean onQueryTextChange(String newText){
  configureBlogsSettings(mBlogsCategory,true);
  return true;
}

Fixed version (ground truth):
@Override public boolean onQueryTextChange(String newText){
  configureBlogsSettings(mBlogsCategory,!mSearchMenuItemCollapsed);
  return true;
}
Program: 13978
Project: 13978
Buggy source:
@Override public void onCreateOptionsMenu(Menu menu,MenuInflater inflater){
  inflater.inflate(R.menu.notifications_settings,menu);
  mSearchMenuItem=menu.findItem(R.id.menu_notifications_settings_search);
  mSearchView=(SearchView)MenuItemCompat.getActionView(mSearchMenuItem);
  mSearchView.setQueryHint(getString(R.string.search_sites));
  mBlogsCategory=(PreferenceCategory)findPreference(getString(R.string.pref_notification_blogs));
  mSearchView.setOnQueryTextListener(new SearchView.OnQueryTextListener(){
    @Override public boolean onQueryTextSubmit(    String query){
      configureBlogsSettings(mBlogsCategory,true);
      return true;
    }
    @Override public boolean onQueryTextChange(    String newText){
      configureBlogsSettings(mBlogsCategory,true);
      return true;
    }
  }
);
  MenuItemCompat.setOnActionExpandListener(mSearchMenuItem,new MenuItemCompat.OnActionExpandListener(){
    @Override public boolean onMenuItemActionExpand(    MenuItem item){
      configureBlogsSettings(mBlogsCategory,true);
      return true;
    }
    @Override public boolean onMenuItemActionCollapse(    MenuItem item){
      configureBlogsSettings(mBlogsCategory,false);
      return true;
    }
  }
);
  updateSearchMenuVisibility();
  if (!TextUtils.isEmpty(mRestoredQuery)) {
    mSearchMenuItem.expandActionView();
    mSearchView.setQuery(mRestoredQuery,true);
  }
}

Fixed version (ground truth):
@Override public void onCreateOptionsMenu(Menu menu,MenuInflater inflater){
  inflater.inflate(R.menu.notifications_settings,menu);
  mSearchMenuItem=menu.findItem(R.id.menu_notifications_settings_search);
  mSearchView=(SearchView)MenuItemCompat.getActionView(mSearchMenuItem);
  mSearchView.setQueryHint(getString(R.string.search_sites));
  mBlogsCategory=(PreferenceCategory)findPreference(getString(R.string.pref_notification_blogs));
  mSearchView.setOnQueryTextListener(new SearchView.OnQueryTextListener(){
    @Override public boolean onQueryTextSubmit(    String query){
      configureBlogsSettings(mBlogsCategory,true);
      return true;
    }
    @Override public boolean onQueryTextChange(    String newText){
      configureBlogsSettings(mBlogsCategory,!mSearchMenuItemCollapsed);
      return true;
    }
  }
);
  MenuItemCompat.setOnActionExpandListener(mSearchMenuItem,new MenuItemCompat.OnActionExpandListener(){
    @Override public boolean onMenuItemActionExpand(    MenuItem item){
      mSearchMenuItemCollapsed=false;
      configureBlogsSettings(mBlogsCategory,true);
      return true;
    }
    @Override public boolean onMenuItemActionCollapse(    MenuItem item){
      mSearchMenuItemCollapsed=true;
      configureBlogsSettings(mBlogsCategory,false);
      return true;
    }
  }
);
  updateSearchMenuVisibility();
  if (!TextUtils.isEmpty(mRestoredQuery)) {
    mSearchMenuItem.expandActionView();
    mSearchView.setQuery(mRestoredQuery,true);
  }
}