nus-yam/ex-repair huggingface dataset:
Program: 187197
Project: 187197
Buggy source:
private void showThumbnail(int position){
  Media[] medias=mMPM.mScene.getMediaAsArray();
  if (medias[position] != null) {
    mImageViewMedia.setVisibility(View.VISIBLE);
    mPreviewVideoView.setVisibility(View.GONE);
    mImageViewMedia.setImageBitmap(mActivity.getThumbnail(medias[position]));
    mImageViewMedia.invalidate();
  }
}

Fixed version (ground truth):
private void showThumbnail(int position){
  Media[] medias=mMPM.mScene.getMediaAsArray();
  if (medias[position] != null) {
    mImageViewMedia.setVisibility(View.VISIBLE);
    mPreviewVideoView.setVisibility(View.GONE);
    Bitmap thumb=Media.getThumbnail(mActivity,medias[position],mActivity.mMPM.mProject);
    mImageViewMedia.setImageBitmap(thumb);
    mImageViewMedia.invalidate();
  }
}
Program: 187199
Project: 187199
Buggy source:
public YouTubeSubmit(File videoFile,String title,String description,Date dateTaken,Activity activity,Handler handler,Context context){
  SharedPreferences settings=PreferenceManager.getDefaultSharedPreferences(mContext.getApplicationContext());
  authorizer=(GlsAuthorizer)new GlsAuthorizer.GlsAuthorizerFactory().getAuthorizer(activity,GlsAuthorizer.YOUTUBE_AUTH_TOKEN_TYPE);
  authorizer.setAccountFeatures(GlsAuthorizer.YOUTUBE_FEATURES);
  authorizer.setAccountType(GlsAuthorizer.ACCOUNT_TYPE_GOOGLE);
  authorizer.setAuthMethod(settings.getInt("String_Node_Str",0));
  authorizer.setHandler(handler);
  this.videoFile=videoFile;
  this.activity=activity;
  this.title=title;
  this.description=description;
  this.dateTaken=dateTaken;
  this.handler=handler;
  this.mContext=context;
  httpClient=new StrongHttpsClient(mContext);
  httpClient.log.enableDebug(true);
  mUseTor=settings.getBoolean("String_Node_Str",false);
  if (mUseTor) {
    httpClient.useProxy(true,"String_Node_Str",AppConstants.TOR_PROXY_HOST,AppConstants.TOR_PROXY_PORT);
  }
}

Fixed version (ground truth):
public YouTubeSubmit(File videoFile,String title,String description,Date dateTaken,Activity activity,Handler handler,Context context){
  this.videoFile=videoFile;
  this.activity=activity;
  this.title=title;
  this.description=description;
  this.dateTaken=dateTaken;
  this.handler=handler;
  this.mContext=context;
  SharedPreferences settings=PreferenceManager.getDefaultSharedPreferences(mContext.getApplicationContext());
  authorizer=(GlsAuthorizer)new GlsAuthorizer.GlsAuthorizerFactory().getAuthorizer(activity,GlsAuthorizer.YOUTUBE_AUTH_TOKEN_TYPE);
  authorizer.setAccountFeatures(GlsAuthorizer.YOUTUBE_FEATURES);
  authorizer.setAccountType(GlsAuthorizer.ACCOUNT_TYPE_GOOGLE);
  authorizer.setAuthMethod(settings.getInt("String_Node_Str",0));
  authorizer.setHandler(handler);
  httpClient=new StrongHttpsClient(mContext);
  httpClient.log.enableDebug(true);
  mUseTor=settings.getBoolean("String_Node_Str",false);
  if (mUseTor) {
    httpClient.useProxy(true,"String_Node_Str",AppConstants.TOR_PROXY_HOST,AppConstants.TOR_PROXY_PORT);
  }
}
Program: 187201
Project: 187201
Buggy source:
@Override public void onClick(View v){
  ViewPager vp=(ViewPager)v.getParent().getParent().getParent().getParent();
  mActivity.mMPM.mClipIndex=vp.getCurrentItem();
  ((SceneEditorActivity)mActivity).openCaptureMode(clip,mClipIndex);
}

Fixed version (ground truth):
@Override public void onClick(View v){
  ((SceneEditorActivity)mActivity).openCaptureMode(clip,mClipIndex);
}
Program: 187203
Project: 187203
Buggy source:
public Bitmap getThumbnail(Media media){
  if (media == null)   return null;
  String path=media.getPath();
  if (media.getMimeType() == null) {
    return null;
  }
 else   if (media.getMimeType().startsWith("String_Node_Str")) {
    File fileThumb=new File(path + "String_Node_Str");
    if (fileThumb.exists()) {
      final BitmapFactory.Options options=new BitmapFactory.Options();
      options.inSampleSize=4;
      return BitmapFactory.decodeFile(fileThumb.getAbsolutePath(),options);
    }
 else {
      Bitmap bmp=MediaUtils.getVideoFrame(path,-1);
      try {
        bmp.compress(Bitmap.CompressFormat.JPEG,70,new FileOutputStream(fileThumb));
      }
 catch (      FileNotFoundException e) {
        Log.e(AppConstants.TAG,"String_Node_Str",e);
      }
      return bmp;
    }
  }
 else   if (media.getMimeType().startsWith("String_Node_Str")) {
    final BitmapFactory.Options options=new BitmapFactory.Options();
    options.inSampleSize=4;
    return BitmapFactory.decodeFile(path,options);
  }
 else {
    return BitmapFactory.decodeResource(getResources(),R.drawable.thumb_complete);
  }
}

Fixed version (ground truth):
public Bitmap getThumbnail(Media media){
  if (media == null)   return null;
  String path=media.getPath();
  if (media.getMimeType() == null) {
    return null;
  }
 else   if (media.getMimeType().startsWith("String_Node_Str")) {
    File fileThumb=new File(path + "String_Node_Str");
    if (fileThumb.exists()) {
      final BitmapFactory.Options options=new BitmapFactory.Options();
      options.inSampleSize=4;
      return BitmapFactory.decodeFile(fileThumb.getAbsolutePath(),options);
    }
 else {
      Bitmap bmp=MediaUtils.getVideoFrame(path,-1);
      try {
        bmp.compress(Bitmap.CompressFormat.JPEG,70,new FileOutputStream(fileThumb));
      }
 catch (      FileNotFoundException e) {
        Log.e(AppConstants.TAG,"String_Node_Str",e);
      }
      return bmp;
    }
  }
 else   if (media.getMimeType().startsWith("String_Node_Str")) {
    final BitmapFactory.Options options=new BitmapFactory.Options();
    options.inSampleSize=4;
    return BitmapFactory.decodeFile(path,options);
  }
 else   if (media.getMimeType().startsWith("String_Node_Str")) {
    return BitmapFactory.decodeResource(getResources(),R.drawable.thumb_audio);
  }
 else {
    return BitmapFactory.decodeResource(getResources(),R.drawable.thumb_complete);
  }
}
Program: 187204
Project: 187204
Buggy source:
public Bitmap getThumbnail(Media media){
  if (media == null)   return null;
  String path=media.getPath();
  if (media.getMimeType() == null) {
    return null;
  }
 else   if (media.getMimeType().startsWith("String_Node_Str")) {
    File fileThumb=new File(path + "String_Node_Str");
    if (fileThumb.exists()) {
      final BitmapFactory.Options options=new BitmapFactory.Options();
      options.inSampleSize=4;
      return BitmapFactory.decodeFile(fileThumb.getAbsolutePath(),options);
    }
 else {
      Bitmap bmp=MediaUtils.getVideoFrame(path,-1);
      try {
        bmp.compress(Bitmap.CompressFormat.JPEG,70,new FileOutputStream(fileThumb));
      }
 catch (      FileNotFoundException e) {
        Log.e(AppConstants.TAG,"String_Node_Str",e);
      }
      return bmp;
    }
  }
 else   if (media.getMimeType().startsWith("String_Node_Str")) {
    final BitmapFactory.Options options=new BitmapFactory.Options();
    options.inSampleSize=4;
    return BitmapFactory.decodeFile(path,options);
  }
 else {
    return BitmapFactory.decodeResource(getResources(),R.drawable.thumb_complete);
  }
}

Fixed version (ground truth):
public Bitmap getThumbnail(Media media){
  if (media == null)   return null;
  String path=media.getPath();
  if (media.getMimeType() == null) {
    return null;
  }
 else   if (media.getMimeType().startsWith("String_Node_Str")) {
    File fileThumb=new File(path + "String_Node_Str");
    if (fileThumb.exists()) {
      final BitmapFactory.Options options=new BitmapFactory.Options();
      options.inSampleSize=4;
      return BitmapFactory.decodeFile(fileThumb.getAbsolutePath(),options);
    }
 else {
      Bitmap bmp=MediaUtils.getVideoFrame(path,-1);
      try {
        bmp.compress(Bitmap.CompressFormat.JPEG,70,new FileOutputStream(fileThumb));
      }
 catch (      FileNotFoundException e) {
        Log.e(AppConstants.TAG,"String_Node_Str",e);
      }
      return bmp;
    }
  }
 else   if (media.getMimeType().startsWith("String_Node_Str")) {
    final BitmapFactory.Options options=new BitmapFactory.Options();
    options.inSampleSize=4;
    return BitmapFactory.decodeFile(path,options);
  }
 else   if (media.getMimeType().startsWith("String_Node_Str")) {
    return BitmapFactory.decodeResource(getResources(),R.drawable.thumb_audio);
  }
 else {
    return BitmapFactory.decodeResource(getResources(),R.drawable.thumb_complete);
  }
}
Program: 187205
Project: 187205
Buggy source:
public Bitmap getThumbnail(Media media){
  if (media == null)   return null;
  String path=media.getPath();
  if (media.getMimeType() == null) {
    return null;
  }
 else   if (media.getMimeType().startsWith("String_Node_Str")) {
    File fileThumb=new File(path + "String_Node_Str");
    if (fileThumb.exists()) {
      final BitmapFactory.Options options=new BitmapFactory.Options();
      options.inSampleSize=4;
      return BitmapFactory.decodeFile(fileThumb.getAbsolutePath(),options);
    }
 else {
      Bitmap bmp=MediaUtils.getVideoFrame(path,-1);
      try {
        bmp.compress(Bitmap.CompressFormat.JPEG,70,new FileOutputStream(fileThumb));
      }
 catch (      FileNotFoundException e) {
        Log.e(AppConstants.TAG,"String_Node_Str",e);
      }
      return bmp;
    }
  }
 else   if (media.getMimeType().startsWith("String_Node_Str")) {
    final BitmapFactory.Options options=new BitmapFactory.Options();
    options.inSampleSize=4;
    return BitmapFactory.decodeFile(path,options);
  }
 else {
    return BitmapFactory.decodeResource(getResources(),R.drawable.thumb_complete);
  }
}

Fixed version (ground truth):
public Bitmap getThumbnail(Media media){
  if (media == null)   return null;
  String path=media.getPath();
  if (media.getMimeType() == null) {
    return null;
  }
 else   if (media.getMimeType().startsWith("String_Node_Str")) {
    File fileThumb=new File(path + "String_Node_Str");
    if (fileThumb.exists()) {
      final BitmapFactory.Options options=new BitmapFactory.Options();
      options.inSampleSize=4;
      return BitmapFactory.decodeFile(fileThumb.getAbsolutePath(),options);
    }
 else {
      Bitmap bmp=MediaUtils.getVideoFrame(path,-1);
      try {
        bmp.compress(Bitmap.CompressFormat.JPEG,70,new FileOutputStream(fileThumb));
      }
 catch (      FileNotFoundException e) {
        Log.e(AppConstants.TAG,"String_Node_Str",e);
      }
      return bmp;
    }
  }
 else   if (media.getMimeType().startsWith("String_Node_Str")) {
    final BitmapFactory.Options options=new BitmapFactory.Options();
    options.inSampleSize=4;
    return BitmapFactory.decodeFile(path,options);
  }
 else   if (media.getMimeType().startsWith("String_Node_Str")) {
    return BitmapFactory.decodeResource(getResources(),R.drawable.thumb_audio);
  }
 else {
    return BitmapFactory.decodeResource(getResources(),R.drawable.thumb_complete);
  }
}
Program: 187206
Project: 187206
Buggy source:
private void renderPreview(){
  String exportFileName="String_Node_Str" + mMPM.mScene.getId();
  Message msg=mHandlerPub.obtainMessage(888);
  msg.getData().putString("String_Node_Str",getActivity().getString(R.string.rendering_clips_));
  mHandlerPub.sendMessage(msg);
  try {
    mMPM.doExportMedia(exportFileName,false);
    MediaDesc mdExported=mMPM.getExportMedia();
    File mediaFile=new File(mdExported.path);
    if (mediaFile.exists()) {
      Message message=mHandlerPub.obtainMessage(777);
      message.getData().putString("String_Node_Str",mdExported.path);
      message.getData().putString("String_Node_Str",mdExported.mimeType);
      mHandlerPub.sendMessage(message);
    }
 else {
      Message msgErr=new Message();
      msgErr.what=-1;
      msgErr.getData().putString("String_Node_Str","String_Node_Str");
      mHandlerPub.sendMessage(msgErr);
    }
  }
 catch (  Exception e) {
    Message msgErr=new Message();
    msgErr.what=-1;
    msgErr.getData().putString("String_Node_Str",e.getLocalizedMessage());
    mHandlerPub.sendMessage(msgErr);
    Log.e(AppConstants.TAG,"String_Node_Str",e);
  }
}

Fixed version (ground truth):
private void renderPreview(){
  Message msg=mHandlerPub.obtainMessage(888);
  msg.getData().putString("String_Node_Str",getActivity().getString(R.string.rendering_clips_));
  mHandlerPub.sendMessage(msg);
  try {
    mMPM.doExportMedia(mMPM.getExportMediaFile(),false,true);
    MediaDesc mdExported=mMPM.getExportMedia();
    File mediaFile=new File(mdExported.path);
    if (mediaFile.exists()) {
      Message message=mHandlerPub.obtainMessage(777);
      message.getData().putString("String_Node_Str",mdExported.path);
      message.getData().putString("String_Node_Str",mdExported.mimeType);
      mHandlerPub.sendMessage(message);
    }
 else {
      Message msgErr=new Message();
      msgErr.what=-1;
      msgErr.getData().putString("String_Node_Str","String_Node_Str");
      mHandlerPub.sendMessage(msgErr);
    }
  }
 catch (  Exception e) {
    Message msgErr=new Message();
    msgErr.what=-1;
    msgErr.getData().putString("String_Node_Str",e.getLocalizedMessage());
    mHandlerPub.sendMessage(msgErr);
    Log.e(AppConstants.TAG,"String_Node_Str",e);
  }
}
Program: 187208
Project: 187208
Buggy source:
public void onClick(DialogInterface dialog,int item){
  mMediaUploadAccount=accounts[item].name;
}

Fixed version (ground truth):
public void onClick(DialogInterface dialog,int item){
  mMediaUploadAccount=accounts[item].name;
  handlePublish(true,true);
}
Program: 187209
Project: 187209
Buggy source:
private void checkYouTubeAccount(){
  SharedPreferences settings=PreferenceManager.getDefaultSharedPreferences(mActivity);
  mMediaUploadAccount=settings.getString("String_Node_Str",null);
  if (mMediaUploadAccount == null) {
    AccountManager accountManager=AccountManager.get(mActivity);
    final Account[] accounts=accountManager.getAccounts();
    if (accounts.length > 0) {
      String[] accountNames=new String[accounts.length];
      for (int i=0; i < accounts.length; i++) {
        accountNames[i]=accounts[i].name + "String_Node_Str" + accounts[i].type+ "String_Node_Str";
      }
      AlertDialog.Builder builder=new AlertDialog.Builder(mActivity);
      builder.setTitle(R.string.choose_account_for_youtube_upload);
      builder.setItems(accountNames,new DialogInterface.OnClickListener(){
        public void onClick(        DialogInterface dialog,        int item){
          mMediaUploadAccount=accounts[item].name;
        }
      }
).show();
    }
  }
}

Fixed version (ground truth):
private void checkYouTubeAccount(){
  SharedPreferences settings=PreferenceManager.getDefaultSharedPreferences(mActivity);
  mMediaUploadAccount=settings.getString("String_Node_Str",null);
  if (mMediaUploadAccount == null) {
    AccountManager accountManager=AccountManager.get(mActivity);
    final Account[] accounts=accountManager.getAccounts();
    if (accounts.length > 0) {
      String[] accountNames=new String[accounts.length];
      for (int i=0; i < accounts.length; i++) {
        accountNames[i]=accounts[i].name + "String_Node_Str" + accounts[i].type+ "String_Node_Str";
      }
      AlertDialog.Builder builder=new AlertDialog.Builder(mActivity);
      builder.setTitle(R.string.choose_account_for_youtube_upload);
      builder.setItems(accountNames,new DialogInterface.OnClickListener(){
        public void onClick(        DialogInterface dialog,        int item){
          mMediaUploadAccount=accounts[item].name;
          handlePublish(true,true);
        }
      }
).show();
    }
  }
}
Program: 187210
Project: 187210
Buggy source:
@Override public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState){
  View view=inflater.inflate(layout,null);
  if (this.layout == R.layout.fragment_story_publish) {
    EditText etTitle=(EditText)view.findViewById(R.id.etStoryTitle);
    EditText etDesc=(EditText)view.findViewById(R.id.editTextDescribe);
    etTitle.setText(mActivity.mMPM.mProject.getTitle());
    ToggleButton tbYouTube=(ToggleButton)view.findViewById(R.id.toggleButtonYoutube);
    tbYouTube.setOnCheckedChangeListener(new OnCheckedChangeListener(){
      @Override public void onCheckedChanged(      CompoundButton buttonView,      boolean isChecked){
        if (isChecked) {
          checkYouTubeAccount();
        }
      }
    }
);
    ToggleButton tbStoryMaker=(ToggleButton)view.findViewById(R.id.toggleButtonStoryMaker);
    tbStoryMaker.setOnCheckedChangeListener(new OnCheckedChangeListener(){
      @Override public void onCheckedChanged(      CompoundButton buttonView,      boolean isChecked){
        if (isChecked) {
          ServerManager sm=StoryMakerApp.getServerManager();
          sm.setContext(mActivity.getBaseContext());
          if (!sm.hasCreds())           showLogin();
        }
      }
    }
);
    Button btnRender=(Button)view.findViewById(R.id.btnRender);
    btnRender.setOnClickListener(new OnClickListener(){
      @Override public void onClick(      View arg0){
        handlePublish(false,false);
      }
    }
);
    Button btn=(Button)view.findViewById(R.id.btnPublish);
    btn.setOnClickListener(new OnClickListener(){
      @Override public void onClick(      View v){
        doPublish();
      }
    }
);
  }
  return view;
}

Fixed version (ground truth):
@Override public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState){
  View view=inflater.inflate(layout,null);
  if (this.layout == R.layout.fragment_story_publish) {
    EditText etTitle=(EditText)view.findViewById(R.id.etStoryTitle);
    EditText etDesc=(EditText)view.findViewById(R.id.editTextDescribe);
    etTitle.setText(mActivity.mMPM.mProject.getTitle());
    Button btnRender=(Button)view.findViewById(R.id.btnRender);
    btnRender.setOnClickListener(new OnClickListener(){
      @Override public void onClick(      View arg0){
        File fileExport=mActivity.mMPM.getExportMediaFile();
        if (fileExport.exists())         fileExport.delete();
        handlePublish(false,false);
      }
    }
);
    Button btn=(Button)view.findViewById(R.id.btnPublish);
    btn.setOnClickListener(new OnClickListener(){
      @Override public void onClick(      View v){
        doPublish();
      }
    }
);
  }
  return view;
}
Program: 187212
Project: 187212
Buggy source:
public void doPublish(){
  ServerManager sm=StoryMakerApp.getServerManager();
  sm.setContext(mActivity.getBaseContext());
  ToggleButton tbYouTube=(ToggleButton)mActivity.findViewById(R.id.toggleButtonYoutube);
  ToggleButton tbStoryMaker=(ToggleButton)mActivity.findViewById(R.id.toggleButtonStoryMaker);
  final boolean doYouTube=tbYouTube.isChecked();
  final boolean doStoryMaker=tbStoryMaker.isChecked();
  if (!sm.hasCreds() && doStoryMaker)   showLogin();
 else   handlePublish(doYouTube,doStoryMaker);
}

Fixed version (ground truth):
public void doPublish(){
  ServerManager sm=StoryMakerApp.getServerManager();
  sm.setContext(mActivity.getBaseContext());
  if (!sm.hasCreds())   showLogin();
 else   checkYouTubeAccount();
}
Program: 187214
Project: 187214
Buggy source:
@Override public void onClick(DialogInterface dialog,int which){
switch (which) {
case DialogInterface.BUTTON_POSITIVE:
    String urlOnline=postUrl;
  if (youTubeId != null)   urlOnline="String_Node_Str" + youTubeId;
Intent i=new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse(urlOnline));
startActivity(i);
break;
case DialogInterface.BUTTON_NEGATIVE:
mMPM.mMediaHelper.playMedia(localMedia,mimeType);
break;
}
}

Fixed version (ground truth):
@Override public void onClick(DialogInterface dialog,int which){
switch (which) {
case DialogInterface.BUTTON_POSITIVE:
    Intent i=new Intent(Intent.ACTION_VIEW);
  i.setData(Uri.parse(postUrl));
startActivity(i);
break;
case DialogInterface.BUTTON_NEGATIVE:
break;
}
}
Program: 187215
Project: 187215
Buggy source:
public void showPublished(final String postUrl,final File localMedia,final String youTubeId,final String mimeType){
  if (youTubeId != null || postUrl != null) {
    DialogInterface.OnClickListener dialogClickListener=new DialogInterface.OnClickListener(){
      @Override public void onClick(      DialogInterface dialog,      int which){
switch (which) {
case DialogInterface.BUTTON_POSITIVE:
          String urlOnline=postUrl;
        if (youTubeId != null)         urlOnline="String_Node_Str" + youTubeId;
      Intent i=new Intent(Intent.ACTION_VIEW);
    i.setData(Uri.parse(urlOnline));
  startActivity(i);
break;
case DialogInterface.BUTTON_NEGATIVE:
mMPM.mMediaHelper.playMedia(localMedia,mimeType);
break;
}
}
}
;
AlertDialog.Builder builder=new AlertDialog.Builder(this);
builder.setMessage(R.string.view_published_media_online_or_local_copy_).setPositiveButton(R.string.youtube,dialogClickListener).setNegativeButton(R.string.local,dialogClickListener).show();
}
 else {
mMPM.mMediaHelper.playMedia(localMedia,mimeType);
}
}

Fixed version (ground truth):
public void showPublished(final String postUrl,final File localMedia,final String youTubeId,final String mimeType){
  if (youTubeId != null || postUrl != null) {
    DialogInterface.OnClickListener dialogClickListener=new DialogInterface.OnClickListener(){
      @Override public void onClick(      DialogInterface dialog,      int which){
switch (which) {
case DialogInterface.BUTTON_POSITIVE:
          Intent i=new Intent(Intent.ACTION_VIEW);
        i.setData(Uri.parse(postUrl));
      startActivity(i);
    break;
case DialogInterface.BUTTON_NEGATIVE:
  break;
}
}
}
;
AlertDialog.Builder builder=new AlertDialog.Builder(this);
builder.setMessage(R.string.view_published_media_online_or_local_copy_).setPositiveButton(R.string.yes,dialogClickListener).setNegativeButton(R.string.no,dialogClickListener).show();
}
 else {
mMPM.mMediaHelper.playMedia(localMedia,mimeType);
}
}
Program: 187217
Project: 187217
Buggy source:
public void fetchAuthToken(final String accountName,Activity activity,final AuthorizationListener<String> listener){
  final Account account=getAccount(accountName);
  if (account != null) {
    accountManager.getAuthToken(account,authTokenType,null,activity,new AccountManagerCallback<Bundle>(){
      public void run(      AccountManagerFuture<Bundle> future){
        try {
          Log.d(Config.APP_NAME,"String_Node_Str" + account.name);
          Bundle extras=future.getResult();
          String authToken=extras.getString(AccountManager.KEY_AUTHTOKEN);
          listener.onSuccess(authToken);
        }
 catch (        OperationCanceledException e) {
          listener.onCanceled();
        }
catch (        IOException e) {
          listener.onError(e);
        }
catch (        AuthenticatorException e) {
          listener.onError(e);
        }
      }
    }
,null);
  }
 else {
    listener.onError(new Exception("String_Node_Str" + accountName));
  }
}

Fixed version (ground truth):
public void fetchAuthToken(final String accountName,Activity activity,final AuthorizationListener<String> listener){
  final Account account=getAccount(accountName);
  Bundle bundle=new Bundle();
  if (account != null) {
    accountManager.getAuthToken(account,authTokenType,bundle,activity,new AccountManagerCallback<Bundle>(){
      public void run(      AccountManagerFuture<Bundle> future){
        try {
          Log.d(Config.APP_NAME,"String_Node_Str" + account.name);
          Bundle extras=future.getResult();
          String authToken=extras.getString(AccountManager.KEY_AUTHTOKEN);
          listener.onSuccess(authToken);
        }
 catch (        OperationCanceledException e) {
          listener.onCanceled();
        }
catch (        IOException e) {
          listener.onError(e);
        }
catch (        AuthenticatorException e) {
          listener.onError(e);
        }
      }
    }
,handler);
  }
 else {
    listener.onError(new Exception("String_Node_Str" + accountName));
  }
}
Program: 187218
Project: 187218
Buggy source:
public YouTubeSubmit(File videoFile,String title,String description,Date dateTaken,Activity activity,Handler handler,Context context){
  this.authorizer=new GlsAuthorizer.GlsAuthorizerFactory().getAuthorizer(activity,GlsAuthorizer.YOUTUBE_AUTH_TOKEN_TYPE);
  this.videoFile=videoFile;
  this.activity=activity;
  this.title=title;
  this.description=description;
  this.dateTaken=dateTaken;
  this.handler=handler;
  this.mContext=context;
  httpClient=new StrongHttpsClient(mContext);
  StrongHttpsClient httpClient=new StrongHttpsClient(mContext);
  SharedPreferences settings=PreferenceManager.getDefaultSharedPreferences(mContext);
  mUseTor=settings.getBoolean("String_Node_Str",false);
  if (mUseTor) {
    httpClient.useProxy(true,"String_Node_Str",AppConstants.TOR_PROXY_HOST,AppConstants.TOR_PROXY_PORT);
  }
}

Fixed version (ground truth):
public YouTubeSubmit(File videoFile,String title,String description,Date dateTaken,Activity activity,Handler handler,Context context){
  authorizer=(GlsAuthorizer)new GlsAuthorizer.GlsAuthorizerFactory().getAuthorizer(activity,GlsAuthorizer.YOUTUBE_AUTH_TOKEN_TYPE);
  authorizer.setHandler(handler);
  this.videoFile=videoFile;
  this.activity=activity;
  this.title=title;
  this.description=description;
  this.dateTaken=dateTaken;
  this.handler=handler;
  this.mContext=context;
  httpClient=new StrongHttpsClient(mContext);
  SharedPreferences settings=PreferenceManager.getDefaultSharedPreferences(mContext);
  mUseTor=settings.getBoolean("String_Node_Str",false);
  if (mUseTor) {
    httpClient.useProxy(true,"String_Node_Str",AppConstants.TOR_PROXY_HOST,AppConstants.TOR_PROXY_PORT);
  }
}
Program: 187219
Project: 187219
Buggy source:
public void addTemplateClip(Clip clip) throws IOException, JSONException {
  mTemplate.getScene(0).addClip(clip);
  mAddClipsPagerAdapter=new AddClipsPagerAdapter(mFm,mTemplate,mScene);
  mAddClipsViewPager.setAdapter(mAddClipsPagerAdapter);
  mAddClipsViewPager.setCurrentItem(mTemplate.getScenes().size() - 1);
  mActivity.mMPM.mClipIndex=mTemplate.getScenes().size() - 1;
  mActivity.mdExported=null;
}

Fixed version (ground truth):
public void addTemplateClip(Clip clip) throws IOException, JSONException {
  mTemplate.getScene(0).addClip(clip);
  mAddClipsPagerAdapter=new AddClipsPagerAdapter(mFm,mTemplate,mScene);
  mAddClipsViewPager.setAdapter(mAddClipsPagerAdapter);
  mAddClipsViewPager.setCurrentItem(mTemplate.getScene(0).getClips().size() - 1);
  mActivity.mMPM.mClipIndex=mTemplate.getScene(0).getClips().size() - 1;
  mActivity.mdExported=null;
}
Program: 187220
Project: 187220
Buggy source:
@Override public void onPageScrolled(int position,float positionOffset,int positionOffsetPixels){
  if (((position + 1) == mTemplate.getScenes().size()) && positionOffset == 0 & positionOffsetPixels == 0) {
    mDragAtEnd++;
    if (mDragAtEnd > 5) {
      AlertDialog.Builder builder=new AlertDialog.Builder(mActivity);
      builder.setMessage(R.string.add_new_clip_to_the_scene_).setPositiveButton(R.string.yes,new DialogInterface.OnClickListener(){
        @Override public void onClick(        DialogInterface dialog,        int which){
          ((SceneEditorActivity)mActivity).addShotToScene();
        }
      }
).setNegativeButton(R.string.no,null).show();
      mDragAtEnd=0;
    }
  }
 else {
    mDragAtEnd=0;
  }
}

Fixed version (ground truth):
@Override public void onPageScrolled(int position,float positionOffset,int positionOffsetPixels){
  if (((position + 1) == mTemplate.getScene(0).getClips().size()) && positionOffset == 0 & positionOffsetPixels == 0) {
    mDragAtEnd++;
    if (mDragAtEnd > 5) {
      AlertDialog.Builder builder=new AlertDialog.Builder(mActivity);
      builder.setMessage(R.string.add_new_clip_to_the_scene_).setPositiveButton(R.string.yes,new DialogInterface.OnClickListener(){
        @Override public void onClick(        DialogInterface dialog,        int which){
          ((SceneEditorActivity)mActivity).addShotToScene();
        }
      }
).setNegativeButton(R.string.no,null).show();
      mDragAtEnd=0;
    }
  }
 else {
    mDragAtEnd=0;
  }
}
Program: 187222
Project: 187222
Buggy source:
public void addTemplateClip(Clip clip) throws IOException, JSONException {
  mTemplate.getScene(0).addClip(clip);
  mAddClipsPagerAdapter=new AddClipsPagerAdapter(mFm,mTemplate,mScene);
  mAddClipsViewPager.setAdapter(mAddClipsPagerAdapter);
  mAddClipsViewPager.setCurrentItem(mTemplate.getScenes().size() - 1);
  mActivity.mMPM.mClipIndex=mTemplate.getScenes().size() - 1;
  mActivity.mdExported=null;
}

Fixed version (ground truth):
public void addTemplateClip(Clip clip) throws IOException, JSONException {
  mTemplate.getScene(0).addClip(clip);
  mAddClipsPagerAdapter=new AddClipsPagerAdapter(mFm,mTemplate,mScene);
  mAddClipsViewPager.setAdapter(mAddClipsPagerAdapter);
  mAddClipsViewPager.setCurrentItem(mTemplate.getScene(0).getClips().size() - 1);
  mActivity.mMPM.mClipIndex=mTemplate.getScene(0).getClips().size() - 1;
  mActivity.mdExported=null;
}
Program: 187223
Project: 187223
Buggy source:
@Override public void onPageScrolled(int position,float positionOffset,int positionOffsetPixels){
  if (((position + 1) == mTemplate.getScenes().size()) && positionOffset == 0 & positionOffsetPixels == 0) {
    mDragAtEnd++;
    if (mDragAtEnd > 5) {
      AlertDialog.Builder builder=new AlertDialog.Builder(mActivity);
      builder.setMessage(R.string.add_new_clip_to_the_scene_).setPositiveButton(R.string.yes,new DialogInterface.OnClickListener(){
        @Override public void onClick(        DialogInterface dialog,        int which){
          ((SceneEditorActivity)mActivity).addShotToScene();
        }
      }
).setNegativeButton(R.string.no,null).show();
      mDragAtEnd=0;
    }
  }
 else {
    mDragAtEnd=0;
  }
}

Fixed version (ground truth):
@Override public void onPageScrolled(int position,float positionOffset,int positionOffsetPixels){
  if (((position + 1) == mTemplate.getScene(0).getClips().size()) && positionOffset == 0 & positionOffsetPixels == 0) {
    mDragAtEnd++;
    if (mDragAtEnd > 5) {
      AlertDialog.Builder builder=new AlertDialog.Builder(mActivity);
      builder.setMessage(R.string.add_new_clip_to_the_scene_).setPositiveButton(R.string.yes,new DialogInterface.OnClickListener(){
        @Override public void onClick(        DialogInterface dialog,        int which){
          ((SceneEditorActivity)mActivity).addShotToScene();
        }
      }
).setNegativeButton(R.string.no,null).show();
      mDragAtEnd=0;
    }
  }
 else {
    mDragAtEnd=0;
  }
}
Program: 187225
Project: 187225
Buggy source:
@Override public int getCount(){
  return sTemplate.getScene(mScene).getClips().size();
}

Fixed version (ground truth):
@Override public int getCount(){
  return sTemplate.getScene(0).getClips().size();
}
Program: 187226
Project: 187226
Buggy source:
@Override public int getCount(){
  return sTemplate.getScene(mScene).getClips().size();
}

Fixed version (ground truth):
@Override public int getCount(){
  return sTemplate.getScene(0).getClips().size();
}
Program: 187227
Project: 187227
Buggy source:
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
  setContentView(R.layout.activity_lessons);
  getSupportActionBar().setDisplayHomeAsUpEnabled(true);
  setSupportProgressBarIndeterminateVisibility(false);
  mListView=new LessonListView(this,this);
  LessonSectionFragment fLessons=new LessonSectionFragment();
  fLessons.setListView(mListView);
  mSectionsPagerAdapter=new SectionsPagerAdapter(getSupportFragmentManager(),fLessons);
  final ActionBar actionBar=getSupportActionBar();
  actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
  mViewPager=(ViewPager)findViewById(R.id.pager);
  mViewPager.setAdapter(mSectionsPagerAdapter);
  mViewPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener(){
    @Override public void onPageSelected(    int position){
      actionBar.setSelectedNavigationItem(position);
    }
  }
);
  for (int i=0; i < mSectionsPagerAdapter.getCount(); i++) {
    actionBar.addTab(actionBar.newTab().setText(mSectionsPagerAdapter.getPageTitle(i)).setTabListener(this));
  }
}

Fixed version (ground truth):
@Override public void onCreate(Bundle savedInstanceState){
  requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_lessons);
  getSupportActionBar().setDisplayHomeAsUpEnabled(true);
  setSupportProgressBarIndeterminateVisibility(false);
  mListView=new LessonListView(this,this);
  LessonSectionFragment fLessons=new LessonSectionFragment();
  fLessons.setListView(mListView);
  mSectionsPagerAdapter=new SectionsPagerAdapter(getSupportFragmentManager(),fLessons);
  final ActionBar actionBar=getSupportActionBar();
  actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
  mViewPager=(ViewPager)findViewById(R.id.pager);
  mViewPager.setAdapter(mSectionsPagerAdapter);
  mViewPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener(){
    @Override public void onPageSelected(    int position){
      actionBar.setSelectedNavigationItem(position);
    }
  }
);
  for (int i=0; i < mSectionsPagerAdapter.getCount(); i++) {
    actionBar.addTab(actionBar.newTab().setText(mSectionsPagerAdapter.getPageTitle(i)).setTabListener(this));
  }
}
Program: 187230
Project: 187230
Buggy source:
public void applyExportSettings(MediaDesc mdout){
  mdout.videoCodec="String_Node_Str";
  mdout.videoBitrate=1500;
  mdout.audioBitrate=128;
  mdout.videoFps="String_Node_Str";
  mdout.width=720;
  mdout.height=480;
}

Fixed version (ground truth):
public void applyExportSettings(MediaDesc mdout){
  mdout.videoBitrate=1500;
  mdout.audioBitrate=128;
  mdout.videoFps="String_Node_Str";
  mdout.width=720;
  mdout.height=480;
}
Program: 187231
Project: 187231
Buggy source:
private MediaDesc prerenderVideo(MediaDesc mediaIn,boolean preconvertMP4) throws Exception {
  FfmpegController ffmpegc=new FfmpegController(mContext);
  File outPath=createOutputFile(mediaIn.path,"String_Node_Str");
  mMediaManager.applyExportSettings(mediaIn);
  MediaDesc mediaOut=ffmpegc.convertToMP4Stream(mediaIn,outPath.getAbsolutePath(),preconvertMP4,mShellCallback);
  return mediaOut;
}

Fixed version (ground truth):
private MediaDesc prerenderVideo(MediaDesc mediaIn,boolean preconvertMP4) throws Exception {
  FfmpegController ffmpegc=new FfmpegController(mContext);
  File outPath=createOutputFile(mediaIn.path,"String_Node_Str");
  mMediaManager.applyExportSettings(mediaIn);
  MediaDesc mediaOut=ffmpegc.convertToMP4Stream(mediaIn,outPath.getAbsolutePath(),mShellCallback);
  return mediaOut;
}
Program: 187232
Project: 187232
Buggy source:
private MediaDesc prerenderAudio(MediaDesc mediaIn) throws Exception {
  FfmpegController ffmpegc=new FfmpegController(mContext);
  File outPath=createOutputFile(mediaIn.path,"String_Node_Str");
  mMediaManager.applyExportSettings(mediaIn);
  mediaIn.videoCodec=null;
  mediaIn.mimeType="String_Node_Str";
  MediaDesc mediaOut=ffmpegc.convertToMP4Stream(mediaIn,outPath.getAbsolutePath(),true,mShellCallback);
  return mediaOut;
}

Fixed version (ground truth):
private MediaDesc prerenderAudio(MediaDesc mediaIn) throws Exception {
  FfmpegController ffmpegc=new FfmpegController(mContext);
  File outPath=createOutputFile(mediaIn.path,"String_Node_Str");
  mMediaManager.applyExportSettings(mediaIn);
  mediaIn.videoCodec=null;
  mediaIn.mimeType="String_Node_Str";
  MediaDesc mediaOut=ffmpegc.convertToMP4Stream(mediaIn,outPath.getAbsolutePath(),mShellCallback);
  return mediaOut;
}
Program: 187233
Project: 187233
Buggy source:
public void writeTo(final OutputStream outstream) throws IOException {
  try {
    is.skip(mStart);
    byte[] tmp=new byte[4096];
    int bytesRead;
    int bytesReadThisChunk=0;
    BufferedOutputStream bos=new BufferedOutputStream(outstream);
    is.skip(mStart);
    while ((bytesRead=is.read(tmp)) != -1) {
      bos.write(tmp,0,bytesRead);
      bytesReadThisChunk+=bytesRead;
      totalBytesUploaded+=bytesRead;
      double percent=(totalBytesUploaded / currentFileSize) * 99;
      Log.d(AppConstants.TAG,"String_Node_Str" + totalBytesUploaded + "String_Node_Str"+ percent+ "String_Node_Str");
      String status=String.format("String_Node_Str",Math.round(totalBytesUploaded),Math.round(currentFileSize));
      Message msg=handler.obtainMessage(888);
      String title="String_Node_Str";
      if (mUseTor)       title="String_Node_Str";
      msg.getData().putString("String_Node_Str",title);
      msg.getData().putString("String_Node_Str",status);
      msg.getData().putInt("String_Node_Str",(int)percent);
      handler.sendMessage(msg);
      if (bytesReadThisChunk == (mEnd - mStart + 1)) {
        break;
      }
    }
    bos.close();
  }
  finally {
    is.close();
  }
}

Fixed version (ground truth):
public void writeTo(final OutputStream outstream) throws IOException {
  try {
    is.skip(mStart);
    byte[] tmp=new byte[4096];
    int bytesRead;
    int bytesReadThisChunk=0;
    BufferedOutputStream bos=new BufferedOutputStream(outstream);
    is.skip(mStart);
    while ((bytesRead=is.read(tmp)) != -1) {
      bos.write(tmp,0,bytesRead);
      bytesReadThisChunk+=bytesRead;
      totalBytesUploaded+=bytesRead;
      double percent=(totalBytesUploaded / currentFileSize) * 99;
      String status=String.format("String_Node_Str",Math.round(totalBytesUploaded),Math.round(currentFileSize));
      Message msg=handler.obtainMessage(888);
      String title="String_Node_Str";
      if (mUseTor)       title="String_Node_Str";
      msg.getData().putString("String_Node_Str",title);
      msg.getData().putString("String_Node_Str",status);
      msg.getData().putInt("String_Node_Str",(int)percent);
      handler.sendMessage(msg);
      if (bytesReadThisChunk == (mEnd - mStart + 1)) {
        break;
      }
    }
    bos.close();
  }
  finally {
    is.close();
  }
}
Program: 187234
Project: 187234
Buggy source:
public void addTemplateClip(Clip clip) throws IOException, JSONException {
  mTemplate.getScene(0).addClip(clip);
  mAddClipsPagerAdapter=new AddClipsPagerAdapter(mFm,mTemplate);
  mAddClipsViewPager.setAdapter(mAddClipsPagerAdapter);
  mAddClipsViewPager.setCurrentItem(mTemplate.getScenes().size() - 1);
  mActivity.mMPM.mClipIndex=mTemplate.getScenes().size() - 1;
  mActivity.mdExported=null;
}

Fixed version (ground truth):
public void addTemplateClip(Clip clip) throws IOException, JSONException {
  mTemplate.getScene(0).addClip(clip);
  mAddClipsPagerAdapter=new AddClipsPagerAdapter(mFm,mTemplate);
  mAddClipsViewPager.setAdapter(mAddClipsPagerAdapter);
  mAddClipsViewPager.setCurrentItem(mTemplate.getScene(0).getClips().size() - 1);
  mActivity.mMPM.mClipIndex=mTemplate.getScene(0).getClips().size() - 1;
  mActivity.mdExported=null;
}
Program: 187235
Project: 187235
Buggy source:
@Override public void onPageScrolled(int position,float positionOffset,int positionOffsetPixels){
  if (((position + 1) == mTemplate.getScenes().size()) && positionOffset == 0 & positionOffsetPixels == 0) {
    mDragAtEnd++;
    if (mDragAtEnd > 5) {
      AlertDialog.Builder builder=new AlertDialog.Builder(mActivity);
      builder.setMessage(R.string.add_new_clip_to_the_scene_).setPositiveButton(R.string.yes,new DialogInterface.OnClickListener(){
        @Override public void onClick(        DialogInterface dialog,        int which){
          ((SceneEditorActivity)mActivity).addShotToScene();
        }
      }
).setNegativeButton(R.string.no,null).show();
      mDragAtEnd=0;
    }
  }
 else {
    mDragAtEnd=0;
  }
}

Fixed version (ground truth):
@Override public void onPageScrolled(int position,float positionOffset,int positionOffsetPixels){
  if (((position + 1) == mTemplate.getScene(0).getClips().size()) && positionOffset == 0 & positionOffsetPixels == 0) {
    mDragAtEnd++;
    if (mDragAtEnd > 5) {
      AlertDialog.Builder builder=new AlertDialog.Builder(mActivity);
      builder.setMessage(R.string.add_new_clip_to_the_scene_).setPositiveButton(R.string.yes,new DialogInterface.OnClickListener(){
        @Override public void onClick(        DialogInterface dialog,        int which){
          ((SceneEditorActivity)mActivity).addShotToScene();
        }
      }
).setNegativeButton(R.string.no,null).show();
      mDragAtEnd=0;
    }
  }
 else {
    mDragAtEnd=0;
  }
}
Program: 187237
Project: 187237
Buggy source:
@Override public int getCount(){
  return sTemplate.getScenes().size();
}

Fixed version (ground truth):
@Override public int getCount(){
  return sTemplate.getScene(0).getClips().size();
}
Program: 187241
Project: 187241
Buggy source:
@Override public boolean onOptionsItemSelected(MenuItem item){
switch (item.getItemId()) {
case android.R.id.home:
    if (templateStory) {
      NavUtils.navigateUpTo(this,new Intent(this,StoryTemplateActivity.class));
    }
 else {
      NavUtils.navigateUpFromSameTask(this);
    }
  return true;
case R.id.itemForward:
int idx=getSupportActionBar().getSelectedNavigationIndex();
getSupportActionBar().setSelectedNavigationItem(Math.min(2,idx + 1));
return true;
case R.id.addFromGallery:
addMediaFromGallery();
return true;
case R.id.addNewShot:
addShotToScene();
return true;
}
return super.onOptionsItemSelected(item);
}

Fixed version (ground truth):
@Override public boolean onOptionsItemSelected(MenuItem item){
switch (item.getItemId()) {
case android.R.id.home:
    if (templateStory) {
      NavUtils.navigateUpTo(this,new Intent(this,StoryTemplateActivity.class));
    }
 else {
      NavUtils.navigateUpFromSameTask(this);
    }
  return true;
case R.id.itemForward:
int idx=getSupportActionBar().getSelectedNavigationIndex();
if (idx < 2) {
getSupportActionBar().setSelectedNavigationItem(Math.min(2,idx + 1));
}
 else {
mPublishFragment.doPublish();
}
return true;
case R.id.addFromGallery:
addMediaFromGallery();
return true;
case R.id.addNewShot:
addShotToScene();
return true;
}
return super.onOptionsItemSelected(item);
}
Program: 187245
Project: 187245
Buggy source:
@Override public void surfaceChanged(SurfaceHolder arg0,int arg1,int arg2,int arg3){
  Camera.Parameters p=camera.getParameters();
  p.setPreviewSize(arg2,arg3);
  bitmap=Bitmap.createBitmap(arg2,arg3,Bitmap.Config.ARGB_8888);
  canvas=new Canvas(bitmap);
  setOverlayImage(overlayIdx);
  try {
    camera.setPreviewDisplay(arg0);
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
  camera.startPreview();
}

Fixed version (ground truth):
@Override public void surfaceChanged(SurfaceHolder arg0,int arg1,int arg2,int arg3){
  if (camera != null) {
    Camera.Parameters p=camera.getParameters();
    p.setPreviewSize(arg2,arg3);
    bitmap=Bitmap.createBitmap(arg2,arg3,Bitmap.Config.ARGB_8888);
    canvas=new Canvas(bitmap);
    setOverlayImage(overlayIdx);
    try {
      camera.setPreviewDisplay(arg0);
    }
 catch (    IOException e) {
      e.printStackTrace();
    }
    camera.startPreview();
  }
}
Program: 187246
Project: 187246
Buggy source:
private void checkTypeAndLaunchEditor(){
  String pName=editTextStoryName.getText().toString();
  if (pName == null || pName.length() == 0) {
  }
 else {
    Project project=new Project(this);
    project.setTitle(pName);
    int checkedId=rGroup.getCheckedRadioButtonId();
    String templateJsonPath=null;
    int storyMode=-1;
    if (checkedId == R.id.radioStoryType0) {
      templateJsonPath="String_Node_Str";
      storyMode=Project.STORY_TYPE_VIDEO;
    }
 else     if (checkedId == R.id.radioStoryType1) {
      storyMode=Project.STORY_TYPE_PHOTO;
      templateJsonPath="String_Node_Str";
    }
 else     if (checkedId == R.id.radioStoryType2) {
      storyMode=Project.STORY_TYPE_AUDIO;
      templateJsonPath="String_Node_Str";
    }
 else     if (checkedId == R.id.radioStoryType3) {
      storyMode=Project.STORY_TYPE_ESSAY;
      templateJsonPath="String_Node_Str";
    }
    project.setStoryType(storyMode);
    project.save();
    Intent intent=new Intent(getBaseContext(),SceneEditorNoSwipeActivity.class);
    intent.putExtra("String_Node_Str",storyMode);
    intent.putExtra("String_Node_Str",templateJsonPath);
    intent.putExtra("String_Node_Str",project.getTitle());
    startActivity(intent);
  }
}

Fixed version (ground truth):
private void checkTypeAndLaunchEditor(){
  String pName=editTextStoryName.getText().toString();
  if (pName == null || pName.length() == 0) {
  }
 else {
    Project project=new Project(this);
    project.setTitle(pName);
    int checkedId=rGroup.getCheckedRadioButtonId();
    String templateJsonPath=null;
    int storyMode=-1;
    if (checkedId == R.id.radioStoryType0) {
      templateJsonPath="String_Node_Str";
      storyMode=Project.STORY_TYPE_VIDEO;
    }
 else     if (checkedId == R.id.radioStoryType1) {
      storyMode=Project.STORY_TYPE_PHOTO;
      templateJsonPath="String_Node_Str";
    }
 else     if (checkedId == R.id.radioStoryType2) {
      storyMode=Project.STORY_TYPE_AUDIO;
      templateJsonPath="String_Node_Str";
    }
 else     if (checkedId == R.id.radioStoryType3) {
      storyMode=Project.STORY_TYPE_ESSAY;
      templateJsonPath="String_Node_Str";
    }
    project.setStoryType(storyMode);
    project.save();
    Intent intent=new Intent(getBaseContext(),SceneEditorNoSwipeActivity.class);
    intent.putExtra("String_Node_Str",storyMode);
    intent.putExtra("String_Node_Str",templateJsonPath);
    intent.putExtra("String_Node_Str",project.getTitle());
    intent.putExtra("String_Node_Str",project.getId());
    startActivity(intent);
  }
}
Program: 187247
Project: 187247
Buggy source:
@Override public void beforeStep(String title){
  TestState testState=this.testState.get();
  if (!testState.isGivenStoryRunning()) {
    notifier.fireTestStarted(testState.currentStep);
  }
}

Fixed version (ground truth):
@Override public void beforeStep(String title){
  TestState testState=this.testState.get();
  if (!testState.isGivenStoryRunning() && testState.currentStep != null) {
    notifier.fireTestStarted(testState.currentStep);
  }
}
Program: 187248
Project: 187248
Buggy source:
public String getJunitSafeString(String string){
  return uniq.getUniqueDescription(replaceLinebreaks(string).replaceAll("String_Node_Str","String_Node_Str"));
}

Fixed version (ground truth):
public String getJunitSafeString(String string){
  return uniq.getUniqueDescription(JUnitStringDecorator.getJunitSafeString(string));
}
Program: 187249
Project: 187249
Buggy source:
@Override public void beforeStory(Story story,boolean isGivenStory){
  logger.info("String_Node_Str",story.getName(),isGivenStory ? "String_Node_Str" : "String_Node_Str");
  if (isGivenStory) {
    notifier.fireTestStarted(currentStep);
    givenStoryContext=true;
  }
 else {
    anyScenarioFailedInCurrentStory=false;
    if (testCounter == 0) {
      notifier.fireTestRunStarted(rootDescription);
    }
    for (    Description storyDescription : storyDescriptions) {
      if (storyDescription.isSuite() && storyDescription.getDisplayName().equals(story.getName())) {
        currentStoryDescription=storyDescription;
        notifier.fireTestStarted(storyDescription);
        scenarioDescriptions=storyDescription.getChildren().iterator();
        moveToNextScenario();
        processBeforeStory();
        currentStep=currentStoryDescription;
      }
 else       if (storyDescription.isTest() && storyDescription.getMethodName() != null && storyDescription.getMethodName().equals(story.getName())) {
        currentStoryDescription=storyDescription;
        notifier.fireTestStarted(currentStoryDescription);
        currentStep=currentStoryDescription;
      }
    }
  }
}

Fixed version (ground truth):
@Override public void beforeStory(Story story,boolean isGivenStory){
  logger.info("String_Node_Str",story.getName(),isGivenStory ? "String_Node_Str" : "String_Node_Str");
  if (isGivenStory) {
    notifier.fireTestStarted(currentStep);
    givenStoryContext=true;
  }
 else {
    anyScenarioFailedInCurrentStory=false;
    if (testCounter == 0) {
      notifier.fireTestRunStarted(rootDescription);
    }
    for (    Description storyDescription : storyDescriptions) {
      if (storyDescription.isSuite() && storyDescription.getDisplayName().equals(JUnitStringDecorator.getJunitSafeString(story.getName()))) {
        currentStoryDescription=storyDescription;
        notifier.fireTestStarted(storyDescription);
        scenarioDescriptions=storyDescription.getChildren().iterator();
        moveToNextScenario();
        processBeforeStory();
        currentStep=currentStoryDescription;
      }
 else       if (storyDescription.isTest() && storyDescription.getMethodName() != null && storyDescription.getMethodName().equals(story.getName())) {
        currentStoryDescription=storyDescription;
        notifier.fireTestStarted(currentStoryDescription);
        currentStep=currentStoryDescription;
      }
    }
  }
}