nus-yam/ex-repair huggingface dataset:
Program: 14201
Project: 14201
Buggy source:
/** 
 * delete (trash) a single comment
 */
private static void deleteComment(final int accountId,final Comment comment,final CommentActionListener actionListener){
  final Blog blog=WordPress.getBlog(accountId);
  if (blog == null || comment == null) {
    if (actionListener != null)     actionListener.onActionResult(false);
    return;
  }
  final Handler handler=new Handler();
  new Thread(){
    @Override public void run(){
      XMLRPCClientInterface client=XMLRPCFactory.instantiate(blog.getUri(),blog.getHttpuser(),blog.getHttppassword());
      Object[] params={blog.getRemoteBlogId(),blog.getUsername(),blog.getPassword(),comment.commentID};
      Object result;
      try {
        result=client.call(ApiHelper.Methods.DELETE_COMMENT,params);
      }
 catch (      final XMLRPCException e) {
        AppLog.e(T.COMMENTS,"String_Node_Str",e);
        result=null;
      }
catch (      IOException e) {
        AppLog.e(T.COMMENTS,"String_Node_Str",e);
        result=null;
      }
catch (      XmlPullParserException e) {
        AppLog.e(T.COMMENTS,"String_Node_Str",e);
        result=null;
      }
      final boolean success=(result != null && Boolean.parseBoolean(result.toString()));
      if (success)       CommentTable.deleteComment(accountId,comment.commentID);
      if (actionListener != null) {
        handler.post(new Runnable(){
          @Override public void run(){
            actionListener.onActionResult(success);
          }
        }
);
      }
    }
  }
.start();
}

Fixed version (ground truth):
/** 
 * delete (trash) a single comment
 */
private static void deleteComment(final int accountId,final Comment comment,final CommentActionListener actionListener){
  final Blog blog=WordPress.getBlog(accountId);
  if (blog == null || comment == null) {
    if (actionListener != null)     actionListener.onActionResult(false);
    return;
  }
  final Handler handler=new Handler();
  new Thread(){
    @Override public void run(){
      XMLRPCClientInterface client=XMLRPCFactory.instantiate(blog.getUri(),blog.getHttpuser(),blog.getHttppassword());
      Object[] params={blog.getRemoteBlogId(),blog.getUsername(),blog.getPassword(),comment.commentID};
      Object result;
      try {
        result=client.call(Method.DELETE_COMMENT,params);
      }
 catch (      final XMLRPCException e) {
        AppLog.e(T.COMMENTS,"String_Node_Str",e);
        result=null;
      }
catch (      IOException e) {
        AppLog.e(T.COMMENTS,"String_Node_Str",e);
        result=null;
      }
catch (      XmlPullParserException e) {
        AppLog.e(T.COMMENTS,"String_Node_Str",e);
        result=null;
      }
      final boolean success=(result != null && Boolean.parseBoolean(result.toString()));
      if (success)       CommentTable.deleteComment(accountId,comment.commentID);
      if (actionListener != null) {
        handler.post(new Runnable(){
          @Override public void run(){
            actionListener.onActionResult(success);
          }
        }
);
      }
    }
  }
.start();
}
Program: 14207
Project: 14207
Buggy source:
private String getCanonicalCategoryName(int category_id){
  String new_category_name=null;
  Map<?,?> result=null;
  Object[] params={blog.getRemoteBlogId(),blog.getUsername(),blog.getPassword(),"String_Node_Str",category_id};
  mClient=XMLRPCFactory.instantiate(blog.getUri(),blog.getHttpuser(),blog.getHttppassword());
  try {
    result=(Map<?,?>)mClient.call(ApiHelper.Methods.GET_TERM,params);
  }
 catch (  XMLRPCException e) {
    AppLog.e(AppLog.T.POSTS,e);
  }
catch (  IOException e) {
    AppLog.e(AppLog.T.POSTS,e);
  }
catch (  XmlPullParserException e) {
    AppLog.e(AppLog.T.POSTS,e);
  }
  if (result != null) {
    if (result.containsKey("String_Node_Str")) {
      new_category_name=result.get("String_Node_Str").toString();
    }
  }
  return new_category_name;
}

Fixed version (ground truth):
private String getCanonicalCategoryName(int category_id){
  String new_category_name=null;
  Map<?,?> result=null;
  Object[] params={blog.getRemoteBlogId(),blog.getUsername(),blog.getPassword(),"String_Node_Str",category_id};
  mClient=XMLRPCFactory.instantiate(blog.getUri(),blog.getHttpuser(),blog.getHttppassword());
  try {
    result=(Map<?,?>)mClient.call(Method.GET_TERM,params);
  }
 catch (  XMLRPCException e) {
    AppLog.e(AppLog.T.POSTS,e);
  }
catch (  IOException e) {
    AppLog.e(AppLog.T.POSTS,e);
  }
catch (  XmlPullParserException e) {
    AppLog.e(AppLog.T.POSTS,e);
  }
  if (result != null) {
    if (result.containsKey("String_Node_Str")) {
      new_category_name=result.get("String_Node_Str").toString();
    }
  }
  return new_category_name;
}
Program: 14209
Project: 14209
Buggy source:
/** 
 * Gets the categories via a xmlrpc call
 * @return result message
 */
public String fetchCategories(){
  String returnMessage;
  Object result[]=null;
  Object[] params={blog.getRemoteBlogId(),blog.getUsername(),blog.getPassword()};
  mClient=XMLRPCFactory.instantiate(blog.getUri(),blog.getHttpuser(),blog.getHttppassword());
  boolean success=false;
  try {
    result=(Object[])mClient.call(ApiHelper.Methods.GET_CATEGORIES,params);
    success=true;
  }
 catch (  XMLRPCException e) {
    AppLog.e(AppLog.T.POSTS,e);
  }
catch (  IOException e) {
    AppLog.e(AppLog.T.POSTS,e);
  }
catch (  XmlPullParserException e) {
    AppLog.e(AppLog.T.POSTS,e);
  }
  if (success) {
    WordPress.wpDB.clearCategories(blog.getLocalTableBlogId());
    for (    Object aResult : result) {
      Map<?,?> curHash=(Map<?,?>)aResult;
      String categoryName=curHash.get("String_Node_Str").toString();
      String categoryID=curHash.get("String_Node_Str").toString();
      String categoryParentID=curHash.get("String_Node_Str").toString();
      int convertedCategoryID=Integer.parseInt(categoryID);
      int convertedCategoryParentID=Integer.parseInt(categoryParentID);
      WordPress.wpDB.insertCategory(blog.getLocalTableBlogId(),convertedCategoryID,convertedCategoryParentID,categoryName);
    }
    returnMessage="String_Node_Str";
  }
 else {
    returnMessage="String_Node_Str";
  }
  return returnMessage;
}

Fixed version (ground truth):
/** 
 * Gets the categories via a xmlrpc call
 * @return result message
 */
public String fetchCategories(){
  String returnMessage;
  Object result[]=null;
  Object[] params={blog.getRemoteBlogId(),blog.getUsername(),blog.getPassword()};
  mClient=XMLRPCFactory.instantiate(blog.getUri(),blog.getHttpuser(),blog.getHttppassword());
  boolean success=false;
  try {
    result=(Object[])mClient.call(Method.GET_CATEGORIES,params);
    success=true;
  }
 catch (  XMLRPCException e) {
    AppLog.e(AppLog.T.POSTS,e);
  }
catch (  IOException e) {
    AppLog.e(AppLog.T.POSTS,e);
  }
catch (  XmlPullParserException e) {
    AppLog.e(AppLog.T.POSTS,e);
  }
  if (success) {
    WordPress.wpDB.clearCategories(blog.getLocalTableBlogId());
    for (    Object aResult : result) {
      Map<?,?> curHash=(Map<?,?>)aResult;
      String categoryName=curHash.get("String_Node_Str").toString();
      String categoryID=curHash.get("String_Node_Str").toString();
      String categoryParentID=curHash.get("String_Node_Str").toString();
      int convertedCategoryID=Integer.parseInt(categoryID);
      int convertedCategoryParentID=Integer.parseInt(categoryParentID);
      WordPress.wpDB.insertCategory(blog.getLocalTableBlogId(),convertedCategoryID,convertedCategoryParentID,categoryName);
    }
    returnMessage="String_Node_Str";
  }
 else {
    returnMessage="String_Node_Str";
  }
  return returnMessage;
}
Program: 14210
Project: 14210
Buggy source:
private void downloadMediaItem(long mediaId){
  Object[] apiParams={mBlog.getRemoteBlogId(),mBlog.getUsername(),mBlog.getPassword(),mediaId};
  XMLRPCClientInterface client=XMLRPCFactory.instantiate(mBlog.getUri(),mBlog.getHttpuser(),mBlog.getHttppassword());
  try {
    Map<?,?> results=(Map<?,?>)client.call(ApiHelper.Methods.GET_MEDIA_ITEM,apiParams);
    if (results != null) {
      String strBlogId=Integer.toString(mBlog.getLocalTableBlogId());
      MediaFile mediaFile=new MediaFile(strBlogId,results,mBlog.isDotcomFlag());
      WordPress.wpDB.saveMediaFile(mediaFile);
      AppLog.d(AppLog.T.POSTS,"String_Node_Str" + mediaFile.getFileURL());
      EventBus.getDefault().post(new PostEvents.PostMediaInfoUpdated(mediaId,mediaFile.getFileURL()));
    }
  }
 catch (  ClassCastException|XMLRPCException|XmlPullParserException|IOException e) {
    AppLog.e(AppLog.T.POSTS,e);
  }
}

Fixed version (ground truth):
private void downloadMediaItem(long mediaId){
  Object[] apiParams={mBlog.getRemoteBlogId(),mBlog.getUsername(),mBlog.getPassword(),mediaId};
  XMLRPCClientInterface client=XMLRPCFactory.instantiate(mBlog.getUri(),mBlog.getHttpuser(),mBlog.getHttppassword());
  try {
    Map<?,?> results=(Map<?,?>)client.call(Method.GET_MEDIA_ITEM,apiParams);
    if (results != null) {
      String strBlogId=Integer.toString(mBlog.getLocalTableBlogId());
      MediaFile mediaFile=new MediaFile(strBlogId,results,mBlog.isDotcomFlag());
      WordPress.wpDB.saveMediaFile(mediaFile);
      AppLog.d(AppLog.T.POSTS,"String_Node_Str" + mediaFile.getFileURL());
      EventBus.getDefault().post(new PostEvents.PostMediaInfoUpdated(mediaId,mediaFile.getFileURL()));
    }
  }
 catch (  ClassCastException|XMLRPCException|XmlPullParserException|IOException e) {
    AppLog.e(AppLog.T.POSTS,e);
  }
}
Program: 14212
Project: 14212
Buggy source:
private Object uploadFileHelper(Object[] params,final File tempFile){
  if (mClient instanceof XMLRPCClient) {
    XMLRPCClient xmlrpcClient=(XMLRPCClient)mClient;
    xmlrpcClient.setOnBytesUploadedListener(new XMLRPCClient.OnBytesUploadedListener(){
      @Override public void onBytesUploaded(      long uploadedBytes){
        if (tempFile.length() == 0) {
          return;
        }
        float percentage=(uploadedBytes * 100) / tempFile.length();
        mPostUploadNotifier.updateNotificationProgress(percentage);
      }
    }
);
  }
  try {
    return mClient.call(ApiHelper.Methods.UPLOAD_FILE,params,tempFile);
  }
 catch (  XMLRPCException e) {
    AppLog.e(T.API,e);
    mErrorMessage=mContext.getResources().getString(R.string.error_media_upload) + "String_Node_Str" + e.getMessage();
    return null;
  }
catch (  IOException e) {
    AppLog.e(T.API,e);
    mErrorMessage=mContext.getResources().getString(R.string.error_media_upload_connection);
    return null;
  }
catch (  XmlPullParserException e) {
    AppLog.e(T.API,e);
    mErrorMessage=mContext.getResources().getString(R.string.error_media_upload);
    return null;
  }
 finally {
    if (tempFile != null && tempFile.exists()) {
      tempFile.delete();
    }
  }
}

Fixed version (ground truth):
private Object uploadFileHelper(Object[] params,final File tempFile){
  if (mClient instanceof XMLRPCClient) {
    XMLRPCClient xmlrpcClient=(XMLRPCClient)mClient;
    xmlrpcClient.setOnBytesUploadedListener(new XMLRPCClient.OnBytesUploadedListener(){
      @Override public void onBytesUploaded(      long uploadedBytes){
        if (tempFile.length() == 0) {
          return;
        }
        float percentage=(uploadedBytes * 100) / tempFile.length();
        mPostUploadNotifier.updateNotificationProgress(percentage);
      }
    }
);
  }
  try {
    return mClient.call(Method.UPLOAD_FILE,params,tempFile);
  }
 catch (  XMLRPCException e) {
    AppLog.e(T.API,e);
    mErrorMessage=mContext.getResources().getString(R.string.error_media_upload) + "String_Node_Str" + e.getMessage();
    return null;
  }
catch (  IOException e) {
    AppLog.e(T.API,e);
    mErrorMessage=mContext.getResources().getString(R.string.error_media_upload_connection);
    return null;
  }
catch (  XmlPullParserException e) {
    AppLog.e(T.API,e);
    mErrorMessage=mContext.getResources().getString(R.string.error_media_upload);
    return null;
  }
 finally {
    if (tempFile != null && tempFile.exists()) {
      tempFile.delete();
    }
  }
}
Program: 14213
Project: 14213
Buggy source:
/** 
 * Request remote site data via XML-RPC.
 */
@Override protected void fetchRemoteData(){
  Thread thread=new Thread(new Runnable(){
    @Override public void run(){
      Object[] params={mBlog.getRemoteBlogId(),mBlog.getUsername(),mBlog.getPassword()};
      instantiateInterface().callAsync(mOptionsCallback,ApiHelper.Methods.GET_OPTIONS,params);
      instantiateInterface().callAsync(mCategoriesCallback,ApiHelper.Methods.GET_CATEGORIES,params);
    }
  }
);
  thread.run();
}

Fixed version (ground truth):
/** 
 * Request remote site data via XML-RPC.
 */
@Override protected void fetchRemoteData(){
  Thread thread=new Thread(new Runnable(){
    @Override public void run(){
      Object[] params={mBlog.getRemoteBlogId(),mBlog.getUsername(),mBlog.getPassword()};
      instantiateInterface().callAsync(mOptionsCallback,Method.GET_OPTIONS,params);
      instantiateInterface().callAsync(mCategoriesCallback,Method.GET_CATEGORIES,params);
    }
  }
);
  thread.run();
}
Program: 14214
Project: 14214
Buggy source:
@Override public void run(){
  Object[] params={mBlog.getRemoteBlogId(),mBlog.getUsername(),mBlog.getPassword()};
  instantiateInterface().callAsync(mOptionsCallback,ApiHelper.Methods.GET_OPTIONS,params);
  instantiateInterface().callAsync(mCategoriesCallback,ApiHelper.Methods.GET_CATEGORIES,params);
}

Fixed version (ground truth):
@Override public void run(){
  Object[] params={mBlog.getRemoteBlogId(),mBlog.getUsername(),mBlog.getPassword()};
  instantiateInterface().callAsync(mOptionsCallback,Method.GET_OPTIONS,params);
  instantiateInterface().callAsync(mCategoriesCallback,Method.GET_CATEGORIES,params);
}
Program: 14215
Project: 14215
Buggy source:
@Override public void saveSettings(){
  super.saveSettings();
  final Map<String,String> params=serializeSelfHostedParams();
  if (params == null || params.isEmpty())   return;
  XMLRPCCallback callback=new XMLRPCCallback(){
    @Override public void onSuccess(    long id,    final Object result){
      notifySavedOnUiThread(null);
      mRemoteSettings.copyFrom(mSettings);
      if (result != null) {
        HashMap<String,Object> properties=new HashMap<>();
        if (result instanceof Map) {
          Map<String,Object> resultMap=(Map)result;
          Set<String> keys=resultMap.keySet();
          for (          String key : keys) {
            Object currentValue=resultMap.get(key);
            if (currentValue != null) {
              properties.put(SAVED_ITEM_PREFIX + key,currentValue);
            }
          }
        }
        AnalyticsUtils.trackWithCurrentBlogDetails(AnalyticsTracker.Stat.SITE_SETTINGS_SAVED_REMOTELY,properties);
      }
    }
    @Override public void onFailure(    long id,    final Exception error){
      notifySavedOnUiThread(error);
    }
  }
;
  final Object[] callParams={mBlog.getRemoteBlogId(),mSettings.username,mSettings.password,params};
  XMLRPCClientInterface xmlrpcInterface=instantiateInterface();
  if (xmlrpcInterface == null)   return;
  xmlrpcInterface.callAsync(callback,ApiHelper.Methods.SET_OPTIONS,callParams);
}

Fixed version (ground truth):
@Override public void saveSettings(){
  super.saveSettings();
  final Map<String,String> params=serializeSelfHostedParams();
  if (params == null || params.isEmpty())   return;
  XMLRPCCallback callback=new XMLRPCCallback(){
    @Override public void onSuccess(    long id,    final Object result){
      notifySavedOnUiThread(null);
      mRemoteSettings.copyFrom(mSettings);
      if (result != null) {
        HashMap<String,Object> properties=new HashMap<>();
        if (result instanceof Map) {
          Map<String,Object> resultMap=(Map)result;
          Set<String> keys=resultMap.keySet();
          for (          String key : keys) {
            Object currentValue=resultMap.get(key);
            if (currentValue != null) {
              properties.put(SAVED_ITEM_PREFIX + key,currentValue);
            }
          }
        }
        AnalyticsUtils.trackWithCurrentBlogDetails(AnalyticsTracker.Stat.SITE_SETTINGS_SAVED_REMOTELY,properties);
      }
    }
    @Override public void onFailure(    long id,    final Exception error){
      notifySavedOnUiThread(error);
    }
  }
;
  final Object[] callParams={mBlog.getRemoteBlogId(),mSettings.username,mSettings.password,params};
  XMLRPCClientInterface xmlrpcInterface=instantiateInterface();
  if (xmlrpcInterface == null)   return;
  xmlrpcInterface.callAsync(callback,Method.SET_OPTIONS,callParams);
}
Program: 14218
Project: 14218
Buggy source:
@Override public void onResume(){
  super.onResume();
  refreshAccountDetails();
  EventBus.getDefault().register(this);
}

Fixed version (ground truth):
@Override public void onResume(){
  super.onResume();
  refreshAccountDetails();
}
Program: 14219
Project: 14219
Buggy source:
private void updateLabel(WPTextView textView,String text){
  if (text == null || text.isEmpty()) {
    textView.setVisibility(View.GONE);
  }
 else {
    textView.setVisibility(View.VISIBLE);
    textView.setText(text);
  }
}

Fixed version (ground truth):
private void updateLabel(WPTextView textView,String text){
  textView.setText(text);
  if (text == null || text.isEmpty()) {
    textView.setVisibility(View.GONE);
  }
 else {
    textView.setVisibility(View.VISIBLE);
  }
}
Program: 14220
Project: 14220
Buggy source:
public void updateAccountSettingsFromRestResponse(JSONObject json){
  mFirstName=json.optString("String_Node_Str");
  mLastName=json.optString("String_Node_Str");
  mAboutMe=json.optString("String_Node_Str");
}

Fixed version (ground truth):
public void updateAccountSettingsFromRestResponse(JSONObject json){
  mFirstName=json.optString("String_Node_Str");
  mLastName=json.optString("String_Node_Str");
  mDisplayName=json.optString("String_Node_Str");
  mAboutMe=json.optString("String_Node_Str");
}
Program: 14222
Project: 14222
Buggy source:
private void startWebActivity(String themeId,ThemeWebActivity.ThemeWebActivityType type){
  String toastText=getString(R.string.no_network_message);
  if (NetworkUtils.isNetworkAvailable(this)) {
    if (mCurrentTheme != null) {
      boolean isCurrentTheme=mCurrentTheme.getId().equals(themeId);
      Map<String,Object> themeProperties=new HashMap<>();
      themeProperties.put(THEME_ID,themeId);
switch (type) {
case PREVIEW:
        AnalyticsUtils.trackWithCurrentBlogDetails(AnalyticsTracker.Stat.THEMES_PREVIEWED_SITE,themeProperties);
      break;
case DEMO:
    AnalyticsUtils.trackWithCurrentBlogDetails(AnalyticsTracker.Stat.THEMES_DEMO_ACCESSED,themeProperties);
  break;
case DETAILS:
AnalyticsUtils.trackWithCurrentBlogDetails(AnalyticsTracker.Stat.THEMES_DETAILS_ACCESSED,themeProperties);
break;
case SUPPORT:
AnalyticsUtils.trackWithCurrentBlogDetails(AnalyticsTracker.Stat.THEMES_SUPPORT_ACCESSED,themeProperties);
break;
}
ThemeWebActivity.openTheme(this,themeId,type,isCurrentTheme);
return;
}
 else {
toastText=getString(R.string.could_not_load_theme);
}
}
Toast.makeText(this,toastText,Toast.LENGTH_SHORT).show();
}

Fixed version (ground truth):
private void startWebActivity(String themeId,ThemeWebActivity.ThemeWebActivityType type){
  String toastText=getString(R.string.no_network_message);
  if (NetworkUtils.isNetworkAvailable(this)) {
    if (mCurrentTheme != null) {
      boolean isCurrentTheme=mCurrentTheme.getId().equals(themeId);
      Map<String,Object> themeProperties=new HashMap<>();
      themeProperties.put(THEME_ID,themeId);
switch (type) {
case PREVIEW:
        if (isCurrentTheme) {
          AnalyticsUtils.trackWithCurrentBlogDetails(AnalyticsTracker.Stat.THEMES_CUSTOMIZE_ACCESSED,themeProperties);
        }
 else {
          AnalyticsUtils.trackWithCurrentBlogDetails(AnalyticsTracker.Stat.THEMES_PREVIEWED_SITE,themeProperties);
        }
      break;
case DEMO:
    AnalyticsUtils.trackWithCurrentBlogDetails(AnalyticsTracker.Stat.THEMES_DEMO_ACCESSED,themeProperties);
  break;
case DETAILS:
AnalyticsUtils.trackWithCurrentBlogDetails(AnalyticsTracker.Stat.THEMES_DETAILS_ACCESSED,themeProperties);
break;
case SUPPORT:
AnalyticsUtils.trackWithCurrentBlogDetails(AnalyticsTracker.Stat.THEMES_SUPPORT_ACCESSED,themeProperties);
break;
}
ThemeWebActivity.openTheme(this,themeId,type,isCurrentTheme);
return;
}
 else {
toastText=getString(R.string.could_not_load_theme);
}
}
Toast.makeText(this,toastText,Toast.LENGTH_SHORT).show();
}
Program: 14223
Project: 14223
Buggy source:
private void startWebActivity(String themeId,ThemeWebActivity.ThemeWebActivityType type){
  String toastText=getString(R.string.no_network_message);
  if (NetworkUtils.isNetworkAvailable(this)) {
    if (mCurrentTheme != null) {
      boolean isCurrentTheme=mCurrentTheme.getId().equals(themeId);
      Map<String,Object> themeProperties=new HashMap<>();
      themeProperties.put(THEME_ID,themeId);
switch (type) {
case PREVIEW:
        AnalyticsUtils.trackWithCurrentBlogDetails(AnalyticsTracker.Stat.THEMES_PREVIEWED_SITE,themeProperties);
      break;
case DEMO:
    AnalyticsUtils.trackWithCurrentBlogDetails(AnalyticsTracker.Stat.THEMES_DEMO_ACCESSED,themeProperties);
  break;
case DETAILS:
AnalyticsUtils.trackWithCurrentBlogDetails(AnalyticsTracker.Stat.THEMES_DETAILS_ACCESSED,themeProperties);
break;
case SUPPORT:
AnalyticsUtils.trackWithCurrentBlogDetails(AnalyticsTracker.Stat.THEMES_SUPPORT_ACCESSED,themeProperties);
break;
}
ThemeWebActivity.openTheme(this,themeId,type,isCurrentTheme);
return;
}
 else {
toastText=getString(R.string.could_not_load_theme);
}
}
Toast.makeText(this,toastText,Toast.LENGTH_SHORT).show();
}

Fixed version (ground truth):
private void startWebActivity(String themeId,ThemeWebActivity.ThemeWebActivityType type){
  String toastText=getString(R.string.no_network_message);
  if (NetworkUtils.isNetworkAvailable(this)) {
    if (mCurrentTheme != null) {
      boolean isCurrentTheme=mCurrentTheme.getId().equals(themeId);
      Map<String,Object> themeProperties=new HashMap<>();
      themeProperties.put(THEME_ID,themeId);
switch (type) {
case PREVIEW:
        if (isCurrentTheme) {
          AnalyticsUtils.trackWithCurrentBlogDetails(AnalyticsTracker.Stat.THEMES_CUSTOMIZE_ACCESSED,themeProperties);
        }
 else {
          AnalyticsUtils.trackWithCurrentBlogDetails(AnalyticsTracker.Stat.THEMES_PREVIEWED_SITE,themeProperties);
        }
      break;
case DEMO:
    AnalyticsUtils.trackWithCurrentBlogDetails(AnalyticsTracker.Stat.THEMES_DEMO_ACCESSED,themeProperties);
  break;
case DETAILS:
AnalyticsUtils.trackWithCurrentBlogDetails(AnalyticsTracker.Stat.THEMES_DETAILS_ACCESSED,themeProperties);
break;
case SUPPORT:
AnalyticsUtils.trackWithCurrentBlogDetails(AnalyticsTracker.Stat.THEMES_SUPPORT_ACCESSED,themeProperties);
break;
}
ThemeWebActivity.openTheme(this,themeId,type,isCurrentTheme);
return;
}
 else {
toastText=getString(R.string.could_not_load_theme);
}
}
Toast.makeText(this,toastText,Toast.LENGTH_SHORT).show();
}
Program: 14224
Project: 14224
Buggy source:
private void showCloseAfterDialog(){
  getNumberPickerDialog(true,mSiteSettings.getCloseAfter() > 0,new CompoundButton.OnCheckedChangeListener(){
    @Override public void onCheckedChanged(    CompoundButton buttonView,    boolean isChecked){
      mSwitchChecked=isChecked;
    }
  }
,R.string.close_after_switch_text,R.string.close_after_description,R.string.close_after_header,1,getResources().getInteger(R.integer.close_after_limit),mSiteSettings.getCloseAfter(),R.string.site_settings_close_after_dialog_title,new DialogInterface.OnClickListener(){
    @Override public void onClick(    DialogInterface dialog,    int which){
      if (mSiteSettings.getCloseAfter() != mNumberPicker.getValue()) {
        if (mSwitchChecked) {
          onPreferenceChange(mCloseAfterPref,mNumberPicker.getValue());
        }
 else {
          onPreferenceChange(mCloseAfterPref,0);
        }
      }
    }
  }
,null);
  mNumberPicker.setFormatter(new NumberPicker.Formatter(){
    @Override public String format(    int value){
      return getResources().getQuantityString(R.plurals.days_quantity,value,value);
    }
  }
);
}

Fixed version (ground truth):
private void showCloseAfterDialog(){
  mSwitchChecked=mSiteSettings.getCloseAfter() > 0;
  getNumberPickerDialog(true,mSwitchChecked,new CompoundButton.OnCheckedChangeListener(){
    @Override public void onCheckedChanged(    CompoundButton buttonView,    boolean isChecked){
      mSwitchChecked=isChecked;
    }
  }
,R.string.close_after_switch_text,R.string.close_after_description,R.string.close_after_header,1,getResources().getInteger(R.integer.close_after_limit),mSiteSettings.getCloseAfter(),R.string.site_settings_close_after_dialog_title,new DialogInterface.OnClickListener(){
    @Override public void onClick(    DialogInterface dialog,    int which){
      if (mSwitchChecked && mSiteSettings.getCloseAfter() != mNumberPicker.getValue()) {
        onPreferenceChange(mCloseAfterPref,mNumberPicker.getValue());
      }
 else {
        onPreferenceChange(mCloseAfterPref,0);
      }
    }
  }
,null);
  mNumberPicker.setFormatter(new NumberPicker.Formatter(){
    @Override public String format(    int value){
      return getResources().getQuantityString(R.plurals.days_quantity,value,value);
    }
  }
);
}
Program: 14225
Project: 14225
Buggy source:
private void showPagingDialog(){
  getNumberPickerDialog(true,mSiteSettings.getPagingCount() > 0,new CompoundButton.OnCheckedChangeListener(){
    @Override public void onCheckedChanged(    CompoundButton buttonView,    boolean isChecked){
      mSwitchChecked=isChecked;
    }
  }
,R.string.site_settings_paging_title,R.string.paging_description,R.string.paging_header,1,getResources().getInteger(R.integer.paging_limit),mSiteSettings.getPagingCount(),R.string.site_settings_paging_title,new DialogInterface.OnClickListener(){
    @Override public void onClick(    DialogInterface dialog,    int which){
      if (mSiteSettings.getPagingCount() != mNumberPicker.getValue()) {
        if (mSwitchChecked) {
          onPreferenceChange(mPagingPref,mNumberPicker.getValue());
        }
 else {
          onPreferenceChange(mPagingPref,0);
        }
      }
    }
  }
,null);
}

Fixed version (ground truth):
private void showPagingDialog(){
  mSwitchChecked=mSiteSettings.getPagingCount() > 0;
  getNumberPickerDialog(true,mSwitchChecked,new CompoundButton.OnCheckedChangeListener(){
    @Override public void onCheckedChanged(    CompoundButton buttonView,    boolean isChecked){
      mSwitchChecked=isChecked;
    }
  }
,R.string.site_settings_paging_title,R.string.paging_description,R.string.paging_header,1,getResources().getInteger(R.integer.paging_limit),mSiteSettings.getPagingCount(),R.string.site_settings_paging_title,new DialogInterface.OnClickListener(){
    @Override public void onClick(    DialogInterface dialog,    int which){
      if (mSwitchChecked && mSiteSettings.getPagingCount() != mNumberPicker.getValue()) {
        onPreferenceChange(mPagingPref,mNumberPicker.getValue());
      }
 else {
        onPreferenceChange(mPagingPref,0);
      }
    }
  }
,null);
}
Program: 14226
Project: 14226
Buggy source:
private void startWebActivity(String themeId,ThemeWebActivity.ThemeWebActivityType type){
  String toastText=getString(R.string.no_network_message);
  if (NetworkUtils.isNetworkAvailable(this)) {
    if (mCurrentTheme != null) {
      boolean isCurrentTheme=mCurrentTheme.getId().equals(themeId);
      Map<String,Object> themeProperties=new HashMap<>();
      themeProperties.put(THEME_ID,themeId);
switch (type) {
case PREVIEW:
        if (isCurrentTheme) {
          AnalyticsUtils.trackWithCurrentBlogDetails(AnalyticsTracker.Stat.THEMES_CUSTOMIZE_ACCESSED,themeProperties);
        }
 else {
          AnalyticsUtils.trackWithCurrentBlogDetails(AnalyticsTracker.Stat.THEMES_PREVIEWED_SITE,themeProperties);
        }
      break;
case DEMO:
    AnalyticsUtils.trackWithCurrentBlogDetails(AnalyticsTracker.Stat.THEMES_DEMO_ACCESSED,themeProperties);
  break;
case DETAILS:
AnalyticsUtils.trackWithCurrentBlogDetails(AnalyticsTracker.Stat.THEMES_DETAILS_ACCESSED,themeProperties);
break;
case SUPPORT:
AnalyticsUtils.trackWithCurrentBlogDetails(AnalyticsTracker.Stat.THEMES_SUPPORT_ACCESSED,themeProperties);
break;
}
ThemeWebActivity.openTheme(this,themeId,type,isCurrentTheme);
return;
}
 else {
toastText=getString(R.string.could_not_load_theme);
}
}
Toast.makeText(this,toastText,Toast.LENGTH_SHORT).show();
}

Fixed version (ground truth):
private void startWebActivity(String themeId,ThemeWebActivity.ThemeWebActivityType type){
  String toastText=getString(R.string.no_network_message);
  if (NetworkUtils.isNetworkAvailable(this)) {
    if (mCurrentTheme != null) {
      boolean isCurrentTheme=mCurrentTheme.getId().equals(themeId);
      Map<String,Object> themeProperties=new HashMap<>();
      themeProperties.put(THEME_ID,themeId);
switch (type) {
case PREVIEW:
        AnalyticsUtils.trackWithCurrentBlogDetails(AnalyticsTracker.Stat.THEMES_PREVIEWED_SITE,themeProperties);
      break;
case DEMO:
    AnalyticsUtils.trackWithCurrentBlogDetails(AnalyticsTracker.Stat.THEMES_DEMO_ACCESSED,themeProperties);
  break;
case DETAILS:
AnalyticsUtils.trackWithCurrentBlogDetails(AnalyticsTracker.Stat.THEMES_DETAILS_ACCESSED,themeProperties);
break;
case SUPPORT:
AnalyticsUtils.trackWithCurrentBlogDetails(AnalyticsTracker.Stat.THEMES_SUPPORT_ACCESSED,themeProperties);
break;
}
ThemeWebActivity.openTheme(this,themeId,type,isCurrentTheme);
return;
}
 else {
toastText=getString(R.string.could_not_load_theme);
}
}
Toast.makeText(this,toastText,Toast.LENGTH_SHORT).show();
}
Program: 14228
Project: 14228
Buggy source:
@Override public boolean onDeleteRequested(){
  SparseBooleanArray checkedItems=list.getCheckedItemPositions();
  HashMap<String,Object> properties=new HashMap<>();
  properties.put("String_Node_Str",checkedItems.size());
  AnalyticsUtils.trackWithCurrentBlogDetails(AnalyticsTracker.Stat.SETTINGS_DELETED_LIST_ITEMS,properties);
  ListAdapter adapter=list.getAdapter();
  for (int i=0; i < checkedItems.size(); i++) {
    final int index=checkedItems.keyAt(i);
    if (checkedItems.get(index) && mEditingList.size() > index) {
      mEditingList.remove(adapter.getItem(index).toString());
    }
  }
  list.setAdapter(new ArrayAdapter<>(getActivity(),R.layout.wp_simple_list_item_1,mEditingList));
  return true;
}

Fixed version (ground truth):
@Override public boolean onDeleteRequested(){
  SparseBooleanArray checkedItems=list.getCheckedItemPositions();
  HashMap<String,Object> properties=new HashMap<>();
  properties.put("String_Node_Str",checkedItems.size());
  AnalyticsUtils.trackWithCurrentBlogDetails(AnalyticsTracker.Stat.SETTINGS_DELETED_LIST_ITEMS,properties);
  ListAdapter adapter=list.getAdapter();
  for (int i=0; i < checkedItems.size(); i++) {
    final int index=checkedItems.keyAt(i);
    if (checkedItems.get(index)) {
      mEditingList.remove(adapter.getItem(index).toString());
    }
  }
  list.setAdapter(new ArrayAdapter<>(getActivity(),R.layout.wp_simple_list_item_1,mEditingList));
  return true;
}
Program: 14229
Project: 14229
Buggy source:
@Override protected void onBindDialogView(View view){
  super.onBindDialogView(view);
  if (view != null) {
    Typeface typeface=TypefaceCache.getTypeface(getContext(),TypefaceCache.FAMILY_OPEN_SANS,Typeface.NORMAL,TypefaceCache.VARIATION_NORMAL);
    EditText editText=getEditText();
    ViewParent oldParent=editText.getParent();
    if (oldParent != view) {
      if (oldParent != null) {
        ((ViewGroup)oldParent).removeView(editText);
      }
      ((View)oldParent).setPadding(((View)oldParent).getPaddingLeft(),0,((View)oldParent).getPaddingRight(),((View)oldParent).getPaddingBottom());
      onAddEditTextToDialogView(view,editText);
    }
    editText.setSelection(editText.getText().length());
    editText.setTypeface(typeface);
    editText.setTextColor(getContext().getResources().getColor(R.color.grey_dark));
  }
}

Fixed version (ground truth):
@Override protected void onBindDialogView(final View view){
  super.onBindDialogView(view);
  if (view != null) {
    Typeface typeface=TypefaceCache.getTypeface(getContext(),TypefaceCache.FAMILY_OPEN_SANS,Typeface.NORMAL,TypefaceCache.VARIATION_NORMAL);
    EditText editText=getEditText();
    ViewParent oldParent=editText.getParent();
    if (oldParent != view) {
      if (oldParent != null) {
        ((ViewGroup)oldParent).removeView(editText);
      }
      ((View)oldParent).setPadding(((View)oldParent).getPaddingLeft(),0,((View)oldParent).getPaddingRight(),((View)oldParent).getPaddingBottom());
      onAddEditTextToDialogView(view,editText);
    }
    editText.setSelection(editText.getText().length());
    editText.setTypeface(typeface);
    editText.setTextColor(getContext().getResources().getColor(R.color.grey_dark));
    editText.requestFocusFromTouch();
    (new Handler()).postDelayed(new Runnable(){
      public void run(){
        InputMethodManager inputMethodManager=(InputMethodManager)view.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
        inputMethodManager.toggleSoftInputFromWindow(view.getWindowToken(),InputMethodManager.SHOW_FORCED,0);
      }
    }
,SHOW_KEYBOARD_DELAY);
  }
}
Program: 14230
Project: 14230
Buggy source:
public static boolean dropAllTables(SQLiteDatabase db) throws SQLiteException {
  if (db == null) {
    return false;
  }
  if (db.isReadOnly()) {
    throw new SQLiteException("String_Node_Str");
  }
  List<String> tableNames=new ArrayList<String>();
  Cursor cursor=db.rawQuery("String_Node_Str",null);
  if (cursor.moveToFirst()) {
    do {
      String tableName=cursor.getString(0);
      if (!tableName.equals("String_Node_Str") && !tableName.equals("String_Node_Str")) {
        tableNames.add(tableName);
      }
    }
 while (cursor.moveToNext());
  }
  db.beginTransaction();
  try {
    for (    String tableName : tableNames) {
      db.execSQL("String_Node_Str" + tableName);
    }
    db.setTransactionSuccessful();
    return true;
  }
  finally {
    db.endTransaction();
  }
}

Fixed version (ground truth):
public static boolean dropAllTables(SQLiteDatabase db) throws SQLiteException {
  if (db == null) {
    return false;
  }
  if (db.isReadOnly()) {
    throw new SQLiteException("String_Node_Str");
  }
  List<String> tableNames=new ArrayList<String>();
  Cursor cursor=db.rawQuery("String_Node_Str",null);
  if (cursor.moveToFirst()) {
    do {
      String tableName=cursor.getString(0);
      if (!tableName.equals("String_Node_Str") && !tableName.equals("String_Node_Str")) {
        tableNames.add(tableName);
      }
    }
 while (cursor.moveToNext());
  }
  db.beginTransaction();
  try {
    for (    String tableName : tableNames) {
      db.execSQL("String_Node_Str" + tableName);
    }
    db.setTransactionSuccessful();
    return true;
  }
  finally {
    db.endTransaction();
    closeCursor(cursor);
  }
}
Program: 14231
Project: 14231
Buggy source:
private void inflateImageView(){
  ViewStub viewStub=(ViewStub)mView.findViewById(R.id.media_listitem_details_stub);
  if (viewStub != null) {
    if (mIsLocal)     viewStub.setLayoutResource(R.layout.media_grid_image_local);
 else     viewStub.setLayoutResource(R.layout.media_grid_image_network);
    viewStub.inflate();
  }
  mImageView=(ImageView)mView.findViewById(R.id.media_listitem_details_image);
  mProgressView.setVisibility(View.VISIBLE);
  mImageView.setImageDrawable(new ColorDrawable(getResources().getColor(R.color.transparent)));
}

Fixed version (ground truth):
private void inflateImageView(){
  ViewStub viewStub=(ViewStub)mView.findViewById(R.id.media_listitem_details_stub);
  if (viewStub != null) {
    if (mIsLocal)     viewStub.setLayoutResource(R.layout.media_grid_image_local);
 else     viewStub.setLayoutResource(R.layout.media_grid_image_network);
    viewStub.inflate();
  }
  mImageView=(ImageView)mView.findViewById(R.id.media_listitem_details_image);
  mProgressView.setVisibility(View.VISIBLE);
  mImageView.setImageDrawable(new ColorDrawable(getResources().getColor(R.color.grey_lighten_20)));
}
Program: 14232
Project: 14232
Buggy source:
public void updateFeaturedImage(int id){
  if (mFeaturedImageId != id) {
    mFeaturedImageId=id;
    if (mFeaturedImageId > 0) {
      int blogId=WordPress.getCurrentBlog().getLocalTableBlogId();
      Cursor cursor=WordPress.wpDB.getMediaFile(String.valueOf(blogId),String.valueOf(mFeaturedImageId));
      if (cursor != null && cursor.moveToFirst()) {
        mFeaturedImageView.setVisibility(View.VISIBLE);
        mFeaturedImageButton.setVisibility(View.GONE);
        int maxWidth=getContext().getResources().getDisplayMetrics().widthPixels;
        int padding=DisplayUtils.dpToPx(getContext(),16);
        int imageWidth=(maxWidth - padding);
        String thumbUrl=WordPressMediaUtils.getNetworkThumbnailUrl(cursor,imageWidth);
        WordPressMediaUtils.loadNetworkImage(thumbUrl,mFeaturedImageView);
      }
      if (cursor != null) {
        cursor.close();
      }
    }
 else {
      mFeaturedImageView.setVisibility(View.GONE);
      mFeaturedImageButton.setVisibility(View.VISIBLE);
    }
  }
}

Fixed version (ground truth):
public void updateFeaturedImage(int id){
  if (mFeaturedImageId != id) {
    mFeaturedImageId=id;
    if (mFeaturedImageId > 0) {
      int blogId=WordPress.getCurrentBlog().getLocalTableBlogId();
      Cursor cursor=WordPress.wpDB.getMediaFile(String.valueOf(blogId),String.valueOf(mFeaturedImageId));
      if (cursor != null && cursor.moveToFirst()) {
        mFeaturedImageView.setVisibility(View.VISIBLE);
        mFeaturedImageButton.setVisibility(View.GONE);
        int maxWidth=getResources().getDisplayMetrics().widthPixels;
        int padding=DisplayUtils.dpToPx(getActivity(),16);
        int imageWidth=(maxWidth - padding);
        String thumbUrl=WordPressMediaUtils.getNetworkThumbnailUrl(cursor,imageWidth);
        WordPressMediaUtils.loadNetworkImage(thumbUrl,mFeaturedImageView);
      }
      if (cursor != null) {
        cursor.close();
      }
    }
 else {
      mFeaturedImageView.setVisibility(View.GONE);
      mFeaturedImageButton.setVisibility(View.VISIBLE);
    }
  }
}
Program: 14233
Project: 14233
Buggy source:
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  PreferenceManager.setDefaultValues(getContext(),R.xml.settings,false);
  SharedPreferences prefs=PreferenceManager.getDefaultSharedPreferences(getContext());
  mSupportNewEditor=prefs.getBoolean(getString(R.string.pref_key_visual_editor_enabled),false);
}

Fixed version (ground truth):
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  if (getActivity() != null) {
    PreferenceManager.setDefaultValues(getActivity(),R.xml.settings,false);
    SharedPreferences prefs=PreferenceManager.getDefaultSharedPreferences(getActivity());
    mSupportNewEditor=prefs.getBoolean(getString(R.string.pref_key_visual_editor_enabled),false);
  }
}
Program: 14234
Project: 14234
Buggy source:
private void launchMediaGalleryActivity(){
  Intent intent=new Intent(getContext(),MediaGalleryPickerActivity.class);
  intent.putExtra(MediaGalleryPickerActivity.PARAM_SELECT_ONE_ITEM,true);
  startActivityForResult(intent,MediaGalleryPickerActivity.REQUEST_CODE);
}

Fixed version (ground truth):
private void launchMediaGalleryActivity(){
  Intent intent=new Intent(getActivity(),MediaGalleryPickerActivity.class);
  intent.putExtra(MediaGalleryPickerActivity.PARAM_SELECT_ONE_ITEM,true);
  startActivityForResult(intent,MediaGalleryPickerActivity.REQUEST_CODE);
}
Program: 14235
Project: 14235
Buggy source:
public static String getPhotonImageUrl(String imageUrl,int width,int height,Quality quality){
  if (TextUtils.isEmpty(imageUrl)) {
    return "String_Node_Str";
  }
  int schemePos=imageUrl.indexOf("String_Node_Str");
  if (schemePos == -1) {
    return imageUrl;
  }
  imageUrl=UrlUtils.removeQuery(imageUrl);
  if (imageUrl.endsWith("String_Node_Str")) {
    return imageUrl;
  }
  if (isMshotsUrl(imageUrl)) {
    return imageUrl + "String_Node_Str" + width+ "String_Node_Str"+ height;
  }
  String query="String_Node_Str";
switch (quality) {
case HIGH:
    query+="String_Node_Str";
  break;
case LOW:
query+="String_Node_Str";
break;
default :
query+="String_Node_Str";
break;
}
if (width > 0 && height > 0) {
query+="String_Node_Str" + width + "String_Node_Str"+ height;
}
 else if (width > 0) {
query+="String_Node_Str" + width;
}
 else if (height > 0) {
query+="String_Node_Str" + height;
}
if (imageUrl.contains("String_Node_Str")) {
if (imageUrl.contains("String_Node_Str") || imageUrl.contains("String_Node_Str") || imageUrl.contains("String_Node_Str")) return imageUrl + query;
}
if (UrlUtils.isHttps(imageUrl)) {
return "String_Node_Str" + imageUrl.substring(schemePos + 3,imageUrl.length()) + query;
}
 else {
return "String_Node_Str" + imageUrl.substring(schemePos + 3,imageUrl.length()) + query;
}
}

Fixed version (ground truth):
public static String getPhotonImageUrl(String imageUrl,int width,int height,Quality quality){
  if (TextUtils.isEmpty(imageUrl)) {
    return "String_Node_Str";
  }
  int schemePos=imageUrl.indexOf("String_Node_Str");
  if (schemePos == -1) {
    return imageUrl;
  }
  imageUrl=UrlUtils.removeQuery(imageUrl);
  if (imageUrl.endsWith("String_Node_Str")) {
    return imageUrl;
  }
  if (isMshotsUrl(imageUrl)) {
    return imageUrl + "String_Node_Str" + width+ "String_Node_Str"+ height;
  }
  String query="String_Node_Str";
switch (quality) {
case HIGH:
    query+="String_Node_Str";
  break;
case LOW:
query+="String_Node_Str";
break;
default :
query+="String_Node_Str";
break;
}
if (width > 0 && height > 0) {
query+="String_Node_Str" + width + "String_Node_Str"+ height;
}
 else if (width > 0) {
query+="String_Node_Str" + width;
}
 else if (height > 0) {
query+="String_Node_Str" + height;
}
if (imageUrl.contains("String_Node_Str")) {
if (imageUrl.contains("String_Node_Str") || imageUrl.contains("String_Node_Str") || imageUrl.contains("String_Node_Str")) return imageUrl + query;
}
if (imageUrl.contains("String_Node_Str")) {
return imageUrl + query;
}
if (UrlUtils.isHttps(imageUrl)) {
return "String_Node_Str" + imageUrl.substring(schemePos + 3,imageUrl.length()) + query;
}
 else {
return "String_Node_Str" + imageUrl.substring(schemePos + 3,imageUrl.length()) + query;
}
}
Program: 14236
Project: 14236
Buggy source:
private void configureImageButton(Context context,ThemeViewHolder themeViewHolder,final String themeId,final boolean isPremium,boolean isCurrent){
  final PopupMenu popupMenu=new PopupMenu(context,themeViewHolder.imageButton);
  popupMenu.getMenuInflater().inflate(R.menu.theme_more,popupMenu.getMenu());
  configureMenuForTheme(popupMenu.getMenu(),isCurrent);
  popupMenu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener(){
    @Override public boolean onMenuItemClick(    MenuItem item){
switch (item.getItemId()) {
case R.id.menu_activate:
        if (isPremium) {
          mCallback.onDetailsSelected(themeId);
        }
 else {
          mCallback.onActivateSelected(themeId);
        }
      break;
case R.id.menu_try_and_customize:
    mCallback.onTryAndCustomizeSelected(themeId);
  break;
case R.id.menu_view:
mCallback.onViewSelected(themeId);
break;
case R.id.menu_details:
mCallback.onDetailsSelected(themeId);
break;
case R.id.menu_support:
default :
mCallback.onSupportSelected(themeId);
break;
}
return true;
}
}
);
themeViewHolder.imageButton.setOnClickListener(new View.OnClickListener(){
@Override public void onClick(View v){
popupMenu.show();
}
}
);
}

Fixed version (ground truth):
private void configureImageButton(Context context,ThemeViewHolder themeViewHolder,final String themeId,final boolean isPremium,boolean isCurrent){
  final PopupMenu popupMenu=new PopupMenu(context,themeViewHolder.imageButton);
  popupMenu.getMenuInflater().inflate(R.menu.theme_more,popupMenu.getMenu());
  configureMenuForTheme(popupMenu.getMenu(),isCurrent);
  popupMenu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener(){
    @Override public boolean onMenuItemClick(    MenuItem item){
      int i=item.getItemId();
      if (i == R.id.menu_activate) {
        if (isPremium) {
          mCallback.onDetailsSelected(themeId);
        }
 else {
          mCallback.onActivateSelected(themeId);
        }
      }
 else       if (i == R.id.menu_try_and_customize) {
        mCallback.onTryAndCustomizeSelected(themeId);
      }
 else       if (i == R.id.menu_view) {
        mCallback.onViewSelected(themeId);
      }
 else       if (i == R.id.menu_details) {
        mCallback.onDetailsSelected(themeId);
      }
 else {
        mCallback.onSupportSelected(themeId);
      }
      return true;
    }
  }
);
  themeViewHolder.imageButton.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View v){
      popupMenu.show();
    }
  }
);
}
Program: 14237
Project: 14237
Buggy source:
private void configureCardView(Context context,ThemeViewHolder themeViewHolder,boolean isCurrent){
  Resources resources=context.getResources();
  if (isCurrent) {
    themeViewHolder.detailsView.setBackgroundColor(resources.getColor(R.color.blue_wordpress));
    themeViewHolder.nameView.setTextColor(resources.getColor(R.color.white));
    themeViewHolder.activeView.setVisibility(View.VISIBLE);
    themeViewHolder.cardView.setCardBackgroundColor(resources.getColor(R.color.blue_wordpress));
  }
 else {
    themeViewHolder.detailsView.setBackgroundColor(resources.getColor(R.color.cardview_light_background));
    themeViewHolder.nameView.setTextColor(resources.getColor(R.color.black));
    themeViewHolder.activeView.setVisibility(View.GONE);
    themeViewHolder.cardView.setCardBackgroundColor(resources.getColor(R.color.cardview_light_background));
  }
}

Fixed version (ground truth):
private void configureCardView(Context context,ThemeViewHolder themeViewHolder,boolean isCurrent){
  Resources resources=context.getResources();
  if (isCurrent) {
    themeViewHolder.detailsView.setBackgroundColor(resources.getColor(R.color.blue_wordpress));
    themeViewHolder.nameView.setTextColor(resources.getColor(R.color.white));
    themeViewHolder.activeView.setVisibility(View.VISIBLE);
    themeViewHolder.cardView.setCardBackgroundColor(resources.getColor(R.color.blue_wordpress));
  }
 else {
    themeViewHolder.detailsView.setBackgroundColor(resources.getColor(android.support.v7.cardview.R.color.cardview_light_background));
    themeViewHolder.nameView.setTextColor(resources.getColor(R.color.black));
    themeViewHolder.activeView.setVisibility(View.GONE);
    themeViewHolder.cardView.setCardBackgroundColor(resources.getColor(android.support.v7.cardview.R.color.cardview_light_background));
  }
}
Program: 14238
Project: 14238
Buggy source:
@Override public boolean onMenuItemClick(MenuItem item){
switch (item.getItemId()) {
case R.id.menu_activate:
    if (isPremium) {
      mCallback.onDetailsSelected(themeId);
    }
 else {
      mCallback.onActivateSelected(themeId);
    }
  break;
case R.id.menu_try_and_customize:
mCallback.onTryAndCustomizeSelected(themeId);
break;
case R.id.menu_view:
mCallback.onViewSelected(themeId);
break;
case R.id.menu_details:
mCallback.onDetailsSelected(themeId);
break;
case R.id.menu_support:
default :
mCallback.onSupportSelected(themeId);
break;
}
return true;
}

Fixed version (ground truth):
@Override public boolean onMenuItemClick(MenuItem item){
  int i=item.getItemId();
  if (i == R.id.menu_activate) {
    if (isPremium) {
      mCallback.onDetailsSelected(themeId);
    }
 else {
      mCallback.onActivateSelected(themeId);
    }
  }
 else   if (i == R.id.menu_try_and_customize) {
    mCallback.onTryAndCustomizeSelected(themeId);
  }
 else   if (i == R.id.menu_view) {
    mCallback.onViewSelected(themeId);
  }
 else   if (i == R.id.menu_details) {
    mCallback.onDetailsSelected(themeId);
  }
 else {
    mCallback.onSupportSelected(themeId);
  }
  return true;
}
Program: 14240
Project: 14240
Buggy source:
public WPImageGetter(TextView view,int maxSize,ImageLoader imageLoader,Drawable loadingDrawable,Drawable failedDrawable){
  mWeakView=new WeakReference<>(view);
  mMaxSize=maxSize;
  mImageLoader=imageLoader;
  mLoadingDrawable=loadingDrawable;
  mFailedDrawable=failedDrawable;
}

Fixed version (ground truth):
public WPImageGetter(TextView view,int maxSize,ImageLoader imageLoader,Drawable loadingDrawable,Drawable failedDrawable){
  mWeakView=new WeakReference<TextView>(view);
  mMaxSize=maxSize;
  mImageLoader=imageLoader;
  mLoadingDrawable=loadingDrawable;
  mFailedDrawable=failedDrawable;
}