nus-yam/ex-repair huggingface dataset:
Program: 187140
Project: 187140
Buggy source:
public void onChooseAccountDialogResult(int resultCode,Intent intent){
  if (resultCode == Activity.RESULT_OK) {
    Log.d("String_Node_Str","String_Node_Str");
    if (intent.hasExtra(ChooseAccountFragment.EXTRAS_ACCOUNT_KEYS)) {
      ArrayList<String> siteKeys=intent.getStringArrayListExtra(ChooseAccountFragment.EXTRAS_ACCOUNT_KEYS);
      if (!siteKeys.isEmpty()) {
        Log.d(TAG,"String_Node_Str" + siteKeys);
        mSiteKeys=siteKeys.toArray(new String[siteKeys.size()]);
        boolean useTor=intent.getBooleanExtra(ChooseAccountFragment.EXTRAS_USE_TOR,false);
        boolean publishToStoryMaker=intent.getBooleanExtra(ChooseAccountFragment.EXTRAS_PUBLISH_TO_STORYMAKER,false);
        showUploadSpinner(true);
        mUploading=true;
        mPlaying=false;
        if (mFileLastExport != null && mFileLastExport.exists()) {
          startUpload(mActivity.mMPM.mProject,mSiteKeys,useTor,publishToStoryMaker);
        }
 else {
          startRender(mActivity.mMPM.mProject,mSiteKeys,useTor,publishToStoryMaker);
        }
      }
 else {
        Utils.toastOnUiThread(mActivity,"String_Node_Str");
      }
    }
 else {
      Utils.toastOnUiThread(mActivity,"String_Node_Str");
    }
  }
 else {
    Log.d("String_Node_Str","String_Node_Str");
    showPlayAndUpload(true);
  }
}

Fixed version (ground truth):
public void onChooseAccountDialogResult(int resultCode,Intent intent){
  if (resultCode == Activity.RESULT_OK) {
    Log.d("String_Node_Str","String_Node_Str");
    if (intent.hasExtra(ChooseAccountFragment.EXTRAS_ACCOUNT_KEYS)) {
      ArrayList<String> siteKeys=intent.getStringArrayListExtra(ChooseAccountFragment.EXTRAS_ACCOUNT_KEYS);
      if (!siteKeys.isEmpty()) {
        Log.d(TAG,"String_Node_Str" + siteKeys);
        mSiteKeys=siteKeys.toArray(new String[siteKeys.size()]);
        boolean useTor=intent.getBooleanExtra(ChooseAccountFragment.EXTRAS_USE_TOR,false);
        boolean publishToStoryMaker=intent.getBooleanExtra(ChooseAccountFragment.EXTRAS_PUBLISH_TO_STORYMAKER,false);
        showUploadSpinner(true);
        mUploading=true;
        mPlaying=false;
        if (mMatchingRenderJob != null) {
          PublishJob publishJob=PublishController.getMatchingPublishJob(getActivity().getApplicationContext(),mActivity.mMPM.mProject,mSiteKeys,useTor,publishToStoryMaker);
          Job newJob=JobTable.cloneJob(getActivity().getApplicationContext(),mMatchingRenderJob);
          newJob.setPublishJobId(publishJob.getId());
          newJob.save();
          mMatchingRenderJob=newJob;
          startUpload(mActivity.mMPM.mProject,mSiteKeys,useTor,publishToStoryMaker);
        }
 else {
          startRender(mActivity.mMPM.mProject,mSiteKeys,useTor,publishToStoryMaker);
        }
      }
 else {
        Utils.toastOnUiThread(mActivity,"String_Node_Str");
      }
    }
 else {
      Utils.toastOnUiThread(mActivity,"String_Node_Str");
    }
  }
 else {
    Log.d("String_Node_Str","String_Node_Str");
    showPlayAndUpload(true);
  }
}
Program: 187142
Project: 187142
Buggy source:
public Job getNextUnfinished(Context context,String type,String site){
  ArrayList<Job> jobs=getUnfinishedAsList(context,type,site);
  if (jobs != null) {
    return jobs.get(0);
  }
 else {
    return null;
  }
}

Fixed version (ground truth):
public Job getNextUnfinished(Context context,String type,PublishJob publishJob,String site){
  ArrayList<Job> jobs=getUnfinishedAsList(context,type,publishJob,site);
  if (jobs != null) {
    return jobs.get(0);
  }
 else {
    return null;
  }
}
Program: 187143
Project: 187143
Buggy source:
public ArrayList<Job> getUnfinishedAsList(Context context,String type,String site){
  ArrayList<Job> jobs=(ArrayList<Job>)getAllAsList(context);
  ArrayList<Job> purgedList=null;
  if (jobs != null) {
    for (    Job job : jobs) {
      if ((job.getFinishedAt() == null) && job.getType().equals(type) && (site == null ? true : job.getSite().equals(site))) {
        if (purgedList == null) {
          purgedList=new ArrayList<Job>();
        }
        purgedList.add(job);
      }
    }
  }
  return purgedList;
}

Fixed version (ground truth):
public ArrayList<Job> getUnfinishedAsList(Context context,String type,PublishJob publishJob,String site){
  ArrayList<Job> jobs=(ArrayList<Job>)getAllAsList(context);
  ArrayList<Job> purgedList=null;
  if (jobs != null) {
    for (    Job job : jobs) {
      if ((job.getFinishedAt() == null) && job.getType().equals(type) && job.getPublishJobId() == publishJob.getId() && (site == null ? true : job.getSite().equals(site))) {
        if (purgedList == null) {
          purgedList=new ArrayList<Job>();
        }
        purgedList.add(job);
      }
    }
  }
  return purgedList;
}
Program: 187144
Project: 187144
Buggy source:
private PublishJob getPublishJob(Project project,String[] siteKeys,boolean useTor,boolean publishToStoryMaker){
  if (mPublishJob == null) {
    mPublishJob=(new PublishJobTable()).getNextUnfinished(mContext,project.getId(),siteKeys);
    if (mPublishJob == null) {
      mPublishJob=new PublishJob(mContext,project.getId(),siteKeys,useTor,publishToStoryMaker);
      mPublishJob.save();
    }
  }
 else {
    mPublishJob.setUseTor(useTor);
    mPublishJob.setPublishToStoryMaker(publishToStoryMaker);
  }
  return mPublishJob;
}

Fixed version (ground truth):
private PublishJob getPublishJob(Project project,String[] siteKeys,boolean useTor,boolean publishToStoryMaker){
  if (mPublishJob == null) {
    mPublishJob=getMatchingPublishJob(mContext,project,siteKeys,useTor,publishToStoryMaker);
  }
 else {
    mPublishJob.setUseTor(useTor);
    mPublishJob.setPublishToStoryMaker(publishToStoryMaker);
  }
  return mPublishJob;
}
Program: 187145
Project: 187145
Buggy source:
private void startUploadService(){
  uploadService=UploadWorker.getInstance(mContext,this);
  uploadService.start();
}

Fixed version (ground truth):
private void startUploadService(){
  uploadService=UploadWorker.getInstance(mContext,this);
  uploadService.start(mPublishJob);
}
Program: 187146
Project: 187146
Buggy source:
private void startRenderService(){
  renderService=RenderWorker.getInstance(mContext,this);
  renderService.start();
}

Fixed version (ground truth):
private void startRenderService(){
  renderService=RenderWorker.getInstance(mContext,this);
  renderService.start(mPublishJob);
}
Program: 187147
Project: 187147
Buggy source:
public void start(){
  Job job=(new JobTable(null)).getNextUnfinished(mContext,JobTable.TYPE_RENDER,null);
  RendererBase renderer=null;
  if (job != null) {
    if (job.isSpec(VideoRenderer.SPEC_KEY)) {
      renderer=new VideoRenderer(mContext,this,job);
    }
 else     if (job.isSpec(AudioRenderer.SPEC_KEY)) {
      renderer=new AudioRenderer(mContext,this,job);
    }
    renderer.start();
  }
}

Fixed version (ground truth):
public void start(PublishJob publishJob){
  Job job=(new JobTable(null)).getNextUnfinished(mContext,JobTable.TYPE_RENDER,publishJob,null);
  RendererBase renderer=null;
  if (job != null) {
    if (job.isSpec(VideoRenderer.SPEC_KEY)) {
      renderer=new VideoRenderer(mContext,this,job);
    }
 else     if (job.isSpec(AudioRenderer.SPEC_KEY)) {
      renderer=new AudioRenderer(mContext,this,job);
    }
    renderer.start();
  }
}
Program: 187148
Project: 187148
Buggy source:
public void start(){
  Job job=(new JobTable(null)).getNextUnfinished(mContext,JobTable.TYPE_UPLOAD,null);
  UploaderBase uploader=null;
  if (job != null) {
    if (job.isSite(Auth.SITE_YOUTUBE)) {
      uploader=new YoutubeUploader(mContext,this,job);
    }
 else     if (job.isSite(Auth.SITE_STORYMAKER)) {
      uploader=new StoryMakerUploader(mContext,this,job);
    }
 else     if (job.isSite(Auth.SITE_FACEBOOK)) {
      uploader=new FacebookUploader(mContext,this,job);
    }
 else     if (job.isSite(Auth.SITE_FLICKR)) {
      uploader=new FlickrUploader(mContext,this,job);
    }
 else     if (job.isSite(Auth.SITE_SOUNDCLOUD)) {
      uploader=new SoundCloudUploader(mContext,this,job);
    }
 else     if (job.isSite(Auth.SITE_SSH)) {
      uploader=new SSHUploader(mContext,this,job);
    }
    uploader.start();
  }
}

Fixed version (ground truth):
public void start(PublishJob publishJob){
  Job job=(new JobTable(null)).getNextUnfinished(mContext,JobTable.TYPE_UPLOAD,publishJob,null);
  UploaderBase uploader=null;
  if (job != null) {
    if (job.isSite(Auth.SITE_YOUTUBE)) {
      uploader=new YoutubeUploader(mContext,this,job);
    }
 else     if (job.isSite(Auth.SITE_STORYMAKER)) {
      uploader=new StoryMakerUploader(mContext,this,job);
    }
 else     if (job.isSite(Auth.SITE_FACEBOOK)) {
      uploader=new FacebookUploader(mContext,this,job);
    }
 else     if (job.isSite(Auth.SITE_FLICKR)) {
      uploader=new FlickrUploader(mContext,this,job);
    }
 else     if (job.isSite(Auth.SITE_SOUNDCLOUD)) {
      uploader=new SoundCloudUploader(mContext,this,job);
    }
 else     if (job.isSite(Auth.SITE_SSH)) {
      uploader=new SSHUploader(mContext,this,job);
    }
    uploader.start();
  }
}
Program: 187150
Project: 187150
Buggy source:
@Override protected void onActivityResult(int reqCode,int resCode,Intent intent){
  if (resCode == RESULT_OK) {
    if (reqCode == REQ_OVERLAY_CAM) {
      File fileMediaFolder=mMPM.getExternalProjectFolder(mProject,getBaseContext());
      if (mProject.getStoryType() == Project.STORY_TYPE_VIDEO) {
        mCapturePath=mMPM.mMediaHelper.captureVideo(fileMediaFolder);
      }
 else       if (mProject.getStoryType() == Project.STORY_TYPE_PHOTO) {
        mCapturePath=mMPM.mMediaHelper.capturePhoto(fileMediaFolder);
      }
 else       if (mProject.getStoryType() == Project.STORY_TYPE_ESSAY) {
        mCapturePath=mMPM.mMediaHelper.capturePhoto(fileMediaFolder);
      }
    }
 else     if (reqCode == REQ_YOUTUBE_AUTH) {
      if (resCode == RESULT_OK) {
        String oauthToken=intent.getStringExtra("String_Node_Str");
        Log.d("String_Node_Str","String_Node_Str" + oauthToken);
        mPublishFragment.setYouTubeAuth(oauthToken);
      }
    }
 else {
      try {
        mMPM.handleResponse(intent,mCapturePath);
        refreshClipPager();
      }
 catch (      IOException e) {
        Log.e(AppConstants.TAG,"String_Node_Str" + mCapturePath,e);
      }
    }
  }
}

Fixed version (ground truth):
@Override protected void onActivityResult(int reqCode,int resCode,Intent intent){
  if (resCode == RESULT_OK) {
    if (reqCode == REQ_OVERLAY_CAM) {
      File fileMediaFolder=mMPM.getExternalProjectFolder(mProject,getBaseContext());
      if (mProject.getStoryType() == Project.STORY_TYPE_VIDEO) {
        mCapturePath=mMPM.mMediaHelper.captureVideo(fileMediaFolder);
      }
 else       if (mProject.getStoryType() == Project.STORY_TYPE_PHOTO) {
        mCapturePath=mMPM.mMediaHelper.capturePhoto(fileMediaFolder);
      }
 else       if (mProject.getStoryType() == Project.STORY_TYPE_ESSAY) {
        mCapturePath=mMPM.mMediaHelper.capturePhoto(fileMediaFolder);
      }
    }
 else     if (reqCode == REQ_YOUTUBE_AUTH) {
      if (resCode == RESULT_OK) {
        String oauthToken=intent.getStringExtra("String_Node_Str");
        Log.d("String_Node_Str","String_Node_Str" + oauthToken);
        mPublishFragment.setYouTubeAuth(oauthToken);
      }
    }
 else     if (reqCode == REQ_GOOGLE_DRIVE) {
    }
 else {
      try {
        mMPM.handleResponse(intent,mCapturePath);
        refreshClipPager();
      }
 catch (      IOException e) {
        Log.e(AppConstants.TAG,"String_Node_Str" + mCapturePath,e);
      }
    }
  }
}
Program: 187151
Project: 187151
Buggy source:
@Override public void start(){
  io.scal.secureshareui.controller.PublishController controller;
  controller=io.scal.secureshareui.controller.PublishController.getPublishController(FacebookPublishController.SITE_KEY);
  controller.setContext(mContext);
  Project project=mJob.getProject();
  PublishJob publishJob=mJob.getPublishJob();
  String path=publishJob.getLastRenderFilePath();
  if (path != null) {
    controller.upload(project.getTitle(),project.getDescription(),path);
  }
 else {
    Log.d(TAG,"String_Node_Str");
  }
}

Fixed version (ground truth):
@Override public void start(){
  final io.scal.secureshareui.controller.PublishController controller=io.scal.secureshareui.controller.PublishController.getPublishController(FacebookPublishController.SITE_KEY);
  controller.setContext(mContext);
  final Project project=mJob.getProject();
  final PublishJob publishJob=mJob.getPublishJob();
  final String path=publishJob.getLastRenderFilePath();
  if (path != null) {
    Handler mainHandler=new Handler(mContext.getMainLooper());
    Runnable myRunnable=new Runnable(){
      @Override public void run(){
        controller.upload(project.getTitle(),project.getDescription(),path);
      }
    }
;
    mainHandler.post(myRunnable);
  }
 else {
    Log.d(TAG,"String_Node_Str");
  }
}
Program: 187152
Project: 187152
Buggy source:
/** 
 * Inflate record from a cursor via direct db access.   This should be used within DB Migrations and Model or Table classes
 * @param db
 * @param context
 * @param cursor
 */
public Scene(SQLiteDatabase db,Context context,Cursor cursor){
  this(context,cursor);
  this.mDB=db;
}

Fixed version (ground truth):
/** 
 * Inflate record from a cursor via direct db access.   This should be used within DB Migrations and Model or Table classes
 * @param db
 * @param context
 * @param cursor
 */
public Scene(SQLiteDatabase db,Context context,Cursor cursor){
  this(context,cursor.getInt(cursor.getColumnIndex(StoryMakerDB.Schema.Scenes.ID)),cursor.getString(cursor.getColumnIndex(StoryMakerDB.Schema.Scenes.COL_TITLE)),cursor.getString(cursor.getColumnIndex(StoryMakerDB.Schema.Scenes.COL_THUMBNAIL_PATH)),cursor.getInt(cursor.getColumnIndex(StoryMakerDB.Schema.Scenes.COL_PROJECT_INDEX)),cursor.getInt(cursor.getColumnIndex(StoryMakerDB.Schema.Scenes.COL_PROJECT_ID)));
  this.mDB=db;
  calculateMaxClipCount();
}
Program: 187153
Project: 187153
Buggy source:
public void saveTrim(){
  Media media=mMPM.mScene.getMediaAsArray()[mCurrentClipIdx];
  boolean dirty=false;
  if (media.getTrimStart() != mRangeSeekBar.getSelectedMinValue()) {
    media.setTrimStart(mRangeSeekBar.getSelectedMinValue());
    dirty=true;
  }
  if (media.getTrimEnd() != mRangeSeekBar.getSelectedMaxValue()) {
    media.setTrimEnd(mRangeSeekBar.getSelectedMaxValue());
    dirty=true;
  }
  if (dirty)   media.save();
}

Fixed version (ground truth):
public void saveTrim(){
  Media media=mMPM.mScene.getMediaAsArray()[mCurrentClipIdx];
  boolean dirty=false;
  mTrimMode=false;
  if (media.getTrimStart() != mRangeSeekBar.getSelectedMinValue()) {
    media.setTrimStart(mRangeSeekBar.getSelectedMinValue());
    dirty=true;
  }
  if (media.getTrimEnd() != mRangeSeekBar.getSelectedMaxValue()) {
    media.setTrimEnd(mRangeSeekBar.getSelectedMaxValue());
    dirty=true;
  }
  if (dirty)   media.save();
}
Program: 187154
Project: 187154
Buggy source:
public void enableTrimMode(boolean enable){
  if (enable) {
    mLLControlBar.setVisibility(View.GONE);
    mRangeSeekBarContainer.setVisibility(View.VISIBLE);
    mTrimMode=true;
    setupTrimUndo();
  }
 else {
    mLLControlBar.setVisibility(View.VISIBLE);
    mRangeSeekBarContainer.setVisibility(View.GONE);
    mTrimMode=false;
  }
}

Fixed version (ground truth):
public void enableTrimMode(){
  if (mTrimMode) {
    mLLControlBar.setVisibility(View.GONE);
    mRangeSeekBarContainer.setVisibility(View.VISIBLE);
    setupTrimUndo();
  }
 else {
    mLLControlBar.setVisibility(View.VISIBLE);
    mRangeSeekBarContainer.setVisibility(View.GONE);
  }
}
Program: 187155
Project: 187155
Buggy source:
public void undoSaveTrim(){
  Media media=mMPM.mScene.getMediaAsArray()[mCurrentClipIdx];
  if (trimStartUndo != -1)   media.setTrimStart(trimStartUndo);
  if (trimEndUndo != -1)   media.setTrimEnd(trimEndUndo);
  media.save();
}

Fixed version (ground truth):
public void undoSaveTrim(){
  Media media=mMPM.mScene.getMediaAsArray()[mCurrentClipIdx];
  mTrimMode=false;
  if (trimStartUndo != -1)   media.setTrimStart(trimStartUndo);
  if (trimEndUndo != -1)   media.setTrimEnd(trimEndUndo);
  media.save();
}
Program: 187156
Project: 187156
Buggy source:
public void loadTrim(){
  Media media=mMPM.mScene.getMediaAsArray()[mCurrentClipIdx];
  if (media != null) {
    mRangeSeekBar.setSelectedMinValue(Math.round(media.getTrimStart()));
    if (media.getTrimEnd() > 0) {
      mRangeSeekBar.setSelectedMaxValue(Math.round(media.getTrimEnd()));
    }
 else {
      mRangeSeekBar.setSelectedMaxValue(99);
    }
  }
}

Fixed version (ground truth):
public boolean loadTrim(){
  Media media=mMPM.mScene.getMediaAsArray()[mCurrentClipIdx];
  if (media != null) {
    mTrimMode=true;
    mRangeSeekBar.setSelectedMinValue(Math.round(media.getTrimStart()));
    if (media.getTrimEnd() > 0) {
      mRangeSeekBar.setSelectedMaxValue(Math.round(media.getTrimEnd()));
    }
 else {
      mRangeSeekBar.setSelectedMaxValue(99);
    }
  }
  return mTrimMode;
}
Program: 187157
Project: 187157
Buggy source:
@Override public void onDestroyActionMode(ActionMode mode){
  ((OrderClipsFragment)mFragmentTab1).enableTrimMode(false);
  mTrimMode=false;
  if (actionModelCancel) {
    ((OrderClipsFragment)mFragmentTab1).undoSaveTrim();
  }
 else {
    ((OrderClipsFragment)mFragmentTab1).saveTrim();
  }
}

Fixed version (ground truth):
@Override public void onDestroyActionMode(ActionMode mode){
  if (actionModelCancel) {
    ((OrderClipsFragment)mFragmentTab1).undoSaveTrim();
  }
 else {
    ((OrderClipsFragment)mFragmentTab1).saveTrim();
  }
  ((OrderClipsFragment)mFragmentTab1).enableTrimMode();
}
Program: 187158
Project: 187158
Buggy source:
@Override public boolean onOptionsItemSelected(MenuItem item){
switch (item.getItemId()) {
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;
case R.id.delShot:
deleteCurrentShot();
return true;
case R.id.exportProjectFiles:
exportProjectFiles();
return true;
case R.id.itemTrim:
if (mFragmentTab1 != null) {
((OrderClipsFragment)mFragmentTab1).loadTrim();
((OrderClipsFragment)mFragmentTab1).enableTrimMode(true);
startActionMode(mActionModeCallback);
}
return true;
}
return super.onOptionsItemSelected(item);
}

Fixed version (ground truth):
@Override public boolean onOptionsItemSelected(MenuItem item){
switch (item.getItemId()) {
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;
case R.id.delShot:
deleteCurrentShot();
return true;
case R.id.exportProjectFiles:
exportProjectFiles();
return true;
case R.id.itemTrim:
if (mFragmentTab1 != null) {
if (((OrderClipsFragment)mFragmentTab1).loadTrim()) {
((OrderClipsFragment)mFragmentTab1).enableTrimMode();
startActionMode(mActionModeCallback);
}
return true;
}
return true;
}
return super.onOptionsItemSelected(item);
}
Program: 187159
Project: 187159
Buggy source:
@Override public boolean onPrepareActionMode(ActionMode mode,Menu menu){
  mTrimMode=true;
  return false;
}

Fixed version (ground truth):
@Override public boolean onPrepareActionMode(ActionMode mode,Menu menu){
  return false;
}
Program: 187161
Project: 187161
Buggy source:
public File captureVideo(File fileExternDir){
  ContentValues values=new ContentValues();
  values.put(MediaStore.Images.Media.TITLE,MediaConstants.CAMCORDER_TMP_FILE);
  values.put(MediaStore.Images.Media.DESCRIPTION,MediaConstants.CAMCORDER_TMP_FILE);
  mActivity.sendBroadcast(new Intent().setAction(AppConstants.Keys.Service.LOCK_LOGS));
  mMediaFileTmp=new File(fileExternDir,new Date().getTime() + '-' + MediaConstants.CAMCORDER_TMP_FILE);
  mMediaUriTmp=Uri.fromFile(mMediaFileTmp);
  Intent intent=new Intent(MediaStore.ACTION_VIDEO_CAPTURE);
  mActivity.startActivityForResult(intent,MediaConstants.CAMERA_RESULT);
  return mMediaFileTmp;
}

Fixed version (ground truth):
public File captureVideo(File fileExternDir){
  ContentValues values=new ContentValues();
  values.put(MediaStore.Images.Media.TITLE,MediaConstants.CAMCORDER_TMP_FILE);
  values.put(MediaStore.Images.Media.DESCRIPTION,MediaConstants.CAMCORDER_TMP_FILE);
  mActivity.sendBroadcast(new Intent().setAction(AppConstants.Keys.Service.LOCK_LOGS));
  mMediaFileTmp=new File(fileExternDir,new Date().getTime() + '-' + MediaConstants.CAMCORDER_TMP_FILE);
  mMediaUriTmp=Uri.fromFile(mMediaFileTmp);
  Intent intent=new Intent(MediaStore.ACTION_VIDEO_CAPTURE);
  intent.putExtra(MediaStore.EXTRA_OUTPUT,mMediaUriTmp);
  mActivity.startActivityForResult(intent,MediaConstants.CAMERA_RESULT);
  return mMediaFileTmp;
}
Program: 187162
Project: 187162
Buggy source:
private static synchronized void initExternalStorage(Context context){
  if (mFileExternDir == null) {
    SharedPreferences settings=PreferenceManager.getDefaultSharedPreferences(context.getApplicationContext());
    mUseInternal=settings.getBoolean("String_Node_Str",false);
    if (mUseInternal)     mFileExternDir=context.getDir(AppConstants.FOLDER_PROJECTS_NAME,Context.MODE_WORLD_WRITEABLE | Context.MODE_WORLD_READABLE);
 else     mFileExternDir=new File(context.getExternalFilesDir(null),AppConstants.FOLDER_PROJECTS_NAME);
    mFileExternDir.mkdirs();
  }
}

Fixed version (ground truth):
@SuppressLint("String_Node_Str") private static synchronized void initExternalStorage(Context context){
  if (sFileExternDir == null) {
    SharedPreferences settings=PreferenceManager.getDefaultSharedPreferences(context.getApplicationContext());
    mUseInternal=settings.getBoolean("String_Node_Str",false);
    boolean isStorageEmulated=false;
    if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.HONEYCOMB) {
      isStorageEmulated=Environment.isExternalStorageEmulated();
    }
    if (mUseInternal && !isStorageEmulated) {
      sFileExternDir=new File(context.getFilesDir(),AppConstants.FOLDER_PROJECTS_NAME);
    }
 else {
      sFileExternDir=new File(Environment.getExternalStorageDirectory(),AppConstants.FOLDER_PROJECTS_NAME);
    }
    sFileExternDir.mkdirs();
  }
}
Program: 187163
Project: 187163
Buggy source:
public static File getExternalProjectFolder(Project project,Context context){
  initExternalStorage(context);
  String folderName=project.getId() + "String_Node_Str";
  File fileProject=new File(mFileExternDir,folderName);
  fileProject.mkdirs();
  return fileProject;
}

Fixed version (ground truth):
public static File getExternalProjectFolder(Project project,Context context){
  initExternalStorage(context);
  String folderName=project.getId() + "String_Node_Str";
  File fileProject=new File(sFileExternDir,folderName);
  fileProject.mkdirs();
  return fileProject;
}
Program: 187164
Project: 187164
Buggy source:
public boolean checkStorageSpace(){
  ArrayList<Media> mList=this.mProject.getMediaAsList();
  Long totalBytesRequired=0l;
  for (  Media media : mList) {
    try {
      if (media == null || media.getPath() == null) {
      }
 else       if (!new File(media.getPath()).exists()) {
        throw new java.io.FileNotFoundException();
      }
 else {
        File currentFile=new File(media.getPath());
        totalBytesRequired+=(long)currentFile.length();
      }
    }
 catch (    java.io.FileNotFoundException fnfe) {
      Log.e(AppConstants.TAG,"String_Node_Str" + "String_Node_Str" + media.getPath(),fnfe);
    }
  }
  String memoryPath;
  if (mUseInternal) {
    memoryPath=Environment.getDataDirectory().getPath();
  }
 else {
    memoryPath=Environment.getExternalStorageDirectory().getPath();
  }
  StatFs stat=new StatFs(memoryPath);
  Long totalBytesAvailable=(long)stat.getAvailableBlocks() * (long)stat.getBlockSize();
  if (totalBytesRequired < totalBytesAvailable) {
    double totalMBRequired=totalBytesRequired / (double)(1024 * 1024);
    Utils.toastOnUiThread(mActivity,String.format(mContext.getString(R.string.error_storage_space),totalMBRequired),true);
    return false;
  }
  return true;
}

Fixed version (ground truth):
public boolean checkStorageSpace(){
  ArrayList<Media> mList=this.mProject.getMediaAsList();
  Long totalBytesRequired=0l;
  for (  Media media : mList) {
    try {
      if (media == null || media.getPath() == null) {
      }
 else       if (!new File(media.getPath()).exists()) {
        throw new java.io.FileNotFoundException();
      }
 else {
        File currentFile=new File(media.getPath());
        totalBytesRequired+=(long)currentFile.length();
      }
    }
 catch (    java.io.FileNotFoundException fnfe) {
      Log.e(AppConstants.TAG,"String_Node_Str" + "String_Node_Str" + media.getPath(),fnfe);
    }
  }
  String memoryPath;
  if (mUseInternal) {
    memoryPath=Environment.getDataDirectory().getPath();
  }
 else {
    memoryPath=Environment.getExternalStorageDirectory().getPath();
  }
  StatFs stat=new StatFs(memoryPath);
  Long totalBytesAvailable=(long)stat.getAvailableBlocks() * (long)stat.getBlockSize();
  if (totalBytesRequired > totalBytesAvailable) {
    double totalMBRequired=totalBytesRequired / (double)(1024 * 1024);
    Utils.toastOnUiThread(mActivity,String.format(mContext.getString(R.string.error_storage_space),totalMBRequired),true);
    return false;
  }
  return true;
}
Program: 187165
Project: 187165
Buggy source:
public void loadTrim(){
  Media media=mMPM.mScene.getMediaAsArray()[mCurrentClipIdx];
  if (media != null) {
    mRangeSeekBar.setSelectedMinValue(media.getTrimStart());
    if (media.getTrimEnd() > 0) {
      mRangeSeekBar.setSelectedMaxValue(media.getTrimEnd());
    }
 else {
      mRangeSeekBar.setSelectedMaxValue(99);
    }
  }
}

Fixed version (ground truth):
public void loadTrim(){
  Media media=mMPM.mScene.getMediaAsArray()[mCurrentClipIdx];
  if (media != null) {
    mRangeSeekBar.setSelectedMinValue(Math.round(media.getTrimStart()));
    if (media.getTrimEnd() > 0) {
      mRangeSeekBar.setSelectedMaxValue(Math.round(media.getTrimEnd()));
    }
 else {
      mRangeSeekBar.setSelectedMaxValue(99);
    }
  }
}
Program: 187167
Project: 187167
Buggy source:
public void setFadeLength(double fadeLen){
  this.fadeLen=fadeLen;
}

Fixed version (ground truth):
public void setFadeLength(float fadeLen){
  this.fadeLen=fadeLen;
}
Program: 187170
Project: 187170
Buggy source:
/** 
 * @return the trimEnd
 */
public int getTrimEnd(){
  return trimEnd;
}

Fixed version (ground truth):
/** 
 * @return the trimEnd
 */
public float getTrimEnd(){
  return trimEnd;
}
Program: 187171
Project: 187171
Buggy source:
/** 
 * @param trimEnd the trimEnd to set
 */
public void setTrimEnd(int trimEnd){
  this.trimEnd=trimEnd;
}

Fixed version (ground truth):
/** 
 * @param trimEnd the trimEnd to set
 */
public void setTrimEnd(float trimEnd){
  this.trimEnd=trimEnd;
}
Program: 187172
Project: 187172
Buggy source:
/** 
 * @return the trimStart
 */
public int getTrimStart(){
  return trimStart;
}

Fixed version (ground truth):
/** 
 * @return the trimStart
 */
public float getTrimStart(){
  return trimStart;
}
Program: 187173
Project: 187173
Buggy source:
/** 
 * @return the duration
 */
public int getDuration(){
  return duration;
}

Fixed version (ground truth):
/** 
 * @return the duration
 */
public float getDuration(){
  return duration;
}
Program: 187174
Project: 187174
Buggy source:
/** 
 * @param trimStart the trimStart to set
 */
public void setTrimStart(int trimStart){
  this.trimStart=trimStart;
}

Fixed version (ground truth):
/** 
 * @param trimStart the trimStart to set
 */
public void setTrimStart(float trimStart){
  this.trimStart=trimStart;
}
Program: 187176
Project: 187176
Buggy source:
public boolean handleBack(){
  if (mSubFolder != null) {
    mSubFolder=null;
    showLessonGroups();
    mHandler.sendEmptyMessage(3);
    return true;
  }
 else   return false;
}

Fixed version (ground truth):
public boolean handleBack(){
  if (mSubFolder != null) {
    mSubFolder=null;
    showLessonGroups();
    mHandler.sendEmptyMessage(3);
    return true;
  }
  return false;
}
Program: 187177
Project: 187177
Buggy source:
@Override public void handleMessage(Message msg){
  super.handleMessage(msg);
switch (msg.what) {
case 0:
    if (msg.getData().containsKey("String_Node_Str"))     Toast.makeText(getContext(),msg.getData().getString("String_Node_Str"),Toast.LENGTH_SHORT).show();
  Object adapter=getAdapter();
if (adapter != null) {
  if (adapter instanceof ArrayAdapter) {
    ((ArrayAdapter)adapter).notifyDataSetChanged();
  }
 else   if (adapter instanceof ListAdapterWrapper) {
    ((ListAdapterWrapper)adapter).notifyDataSetChanged();
  }
}
break;
case 1:
mListLessons=mLessonManager.loadLessonList(getContext(),mLocale.getLanguage());
loadLessonListAdapter();
break;
case 2:
mActivity.mProgressLoading.cancel();
break;
case 3:
setAdapter(new LessonGroupArrayAdapter(getContext(),R.layout.list_lesson_row,mLessonGroups));
break;
case 4:
if (mActivity.mProgressLoading != null) mActivity.mProgressLoading.cancel();
Toast.makeText(getContext(),msg.getData().getString("String_Node_Str"),Toast.LENGTH_LONG).show();
break;
case 5:
mActivity.updateLessonProgress(msg.getData().getString("String_Node_Str"));
default :
}
}

Fixed version (ground truth):
@Override public void handleMessage(Message msg){
  super.handleMessage(msg);
switch (msg.what) {
case 0:
    if (msg.getData().containsKey("String_Node_Str"))     Toast.makeText(getContext(),msg.getData().getString("String_Node_Str"),Toast.LENGTH_SHORT).show();
  Object adapter=getAdapter();
if (adapter != null) {
  if (adapter instanceof ArrayAdapter) {
    ((ArrayAdapter)adapter).notifyDataSetChanged();
  }
 else   if (adapter instanceof ListAdapterWrapper) {
    ((ListAdapterWrapper)adapter).notifyDataSetChanged();
  }
}
break;
case 1:
mListLessons=mLessonManager.loadLessonList(getContext(),mLocale.getLanguage());
loadLessonListAdapter();
break;
case 2:
if (mActivity != null && mActivity.mProgressLoading != null) mActivity.mProgressLoading.cancel();
break;
case 3:
setAdapter(new LessonGroupArrayAdapter(getContext(),R.layout.list_lesson_row,mLessonGroups));
break;
case 4:
if (mActivity != null && mActivity.mProgressLoading != null) mActivity.mProgressLoading.cancel();
Toast.makeText(getContext(),msg.getData().getString("String_Node_Str"),Toast.LENGTH_LONG).show();
break;
case 5:
if (mActivity != null && mActivity.mProgressLoading != null) mActivity.updateLessonProgress(msg.getData().getString("String_Node_Str"));
default :
}
}
Program: 187178
Project: 187178
Buggy source:
public static void updateLessonResource(Context context,Lesson lesson,String locale) throws IOException {
  File fileIdx=new File(lesson.mResourcePath);
  InputStream is=context.getAssets().open("String_Node_Str" + locale);
  OutputStream os=new java.io.FileOutputStream(fileIdx);
  IOUtils.copyLarge(is,os);
}

Fixed version (ground truth):
public static void updateLessonResource(Context context,Lesson lesson,String locale) throws IOException {
  File fileIdx=new File(lesson.mResourcePath);
  InputStream is=context.getAssets().open("String_Node_Str" + locale);
  OutputStream os=new java.io.FileOutputStream(fileIdx);
  IOUtils.copy(is,os);
}
Program: 187180
Project: 187180
Buggy source:
/** 
 * Unpacks the give zip file using the built in Java facilities for unzip. 
 */
@SuppressWarnings("String_Node_Str") public void unpack(File zipFile,File rootDir) throws IOException {
  ZipFile zip=new ZipFile(zipFile);
  Enumeration<ZipEntry> entries=(Enumeration<ZipEntry>)zip.entries();
  ZipEntry entry=null;
  while (entries.hasMoreElements()) {
    entry=entries.nextElement();
    java.io.File f=new java.io.File(rootDir,entry.getName());
    if (entry.isDirectory()) {
      continue;
    }
    if (!f.exists()) {
      f.getParentFile().mkdirs();
      f.createNewFile();
    }
    InputStream is=zip.getInputStream(entry);
    OutputStream os=new java.io.FileOutputStream(f);
    IOUtils.copyLarge(is,os);
  }
}

Fixed version (ground truth):
/** 
 * Unpacks the give zip file using the built in Java facilities for unzip. 
 */
@SuppressWarnings("String_Node_Str") public void unpack(File zipFile,File rootDir) throws IOException {
  ZipFile zip=new ZipFile(zipFile);
  Enumeration<ZipEntry> entries=(Enumeration<ZipEntry>)zip.entries();
  ZipEntry entry=null;
  while (entries.hasMoreElements()) {
    entry=entries.nextElement();
    java.io.File f=new java.io.File(rootDir,entry.getName());
    if (entry.isDirectory()) {
      continue;
    }
    if (!f.exists()) {
      f.getParentFile().mkdirs();
      f.createNewFile();
    }
    InputStream is=zip.getInputStream(entry);
    OutputStream os=new java.io.FileOutputStream(f);
    IOUtils.copy(is,os);
  }
}
Program: 187181
Project: 187181
Buggy source:
public boolean handleBack(){
  if (mSubFolder != null) {
    mSubFolder=null;
    showLessonGroups();
    mHandler.sendEmptyMessage(3);
    return true;
  }
 else   return false;
}

Fixed version (ground truth):
public boolean handleBack(){
  if (mSubFolder != null) {
    mSubFolder=null;
    showLessonGroups();
    mHandler.sendEmptyMessage(3);
    return true;
  }
  return false;
}
Program: 187182
Project: 187182
Buggy source:
@Override public void handleMessage(Message msg){
  super.handleMessage(msg);
switch (msg.what) {
case 0:
    if (msg.getData().containsKey("String_Node_Str"))     Toast.makeText(getContext(),msg.getData().getString("String_Node_Str"),Toast.LENGTH_SHORT).show();
  Object adapter=getAdapter();
if (adapter != null) {
  if (adapter instanceof ArrayAdapter) {
    ((ArrayAdapter)adapter).notifyDataSetChanged();
  }
 else   if (adapter instanceof ListAdapterWrapper) {
    ((ListAdapterWrapper)adapter).notifyDataSetChanged();
  }
}
break;
case 1:
mListLessons=mLessonManager.loadLessonList(getContext(),mLocale.getLanguage());
loadLessonListAdapter();
break;
case 2:
mActivity.mProgressLoading.cancel();
break;
case 3:
setAdapter(new LessonGroupArrayAdapter(getContext(),R.layout.list_lesson_row,mLessonGroups));
break;
case 4:
if (mActivity.mProgressLoading != null) mActivity.mProgressLoading.cancel();
Toast.makeText(getContext(),msg.getData().getString("String_Node_Str"),Toast.LENGTH_LONG).show();
break;
case 5:
mActivity.updateLessonProgress(msg.getData().getString("String_Node_Str"));
default :
}
}

Fixed version (ground truth):
@Override public void handleMessage(Message msg){
  super.handleMessage(msg);
switch (msg.what) {
case 0:
    if (msg.getData().containsKey("String_Node_Str"))     Toast.makeText(getContext(),msg.getData().getString("String_Node_Str"),Toast.LENGTH_SHORT).show();
  Object adapter=getAdapter();
if (adapter != null) {
  if (adapter instanceof ArrayAdapter) {
    ((ArrayAdapter)adapter).notifyDataSetChanged();
  }
 else   if (adapter instanceof ListAdapterWrapper) {
    ((ListAdapterWrapper)adapter).notifyDataSetChanged();
  }
}
break;
case 1:
mListLessons=mLessonManager.loadLessonList(getContext(),mLocale.getLanguage());
loadLessonListAdapter();
break;
case 2:
if (mActivity != null && mActivity.mProgressLoading != null) mActivity.mProgressLoading.cancel();
break;
case 3:
setAdapter(new LessonGroupArrayAdapter(getContext(),R.layout.list_lesson_row,mLessonGroups));
break;
case 4:
if (mActivity != null && mActivity.mProgressLoading != null) mActivity.mProgressLoading.cancel();
Toast.makeText(getContext(),msg.getData().getString("String_Node_Str"),Toast.LENGTH_LONG).show();
break;
case 5:
if (mActivity != null && mActivity.mProgressLoading != null) mActivity.updateLessonProgress(msg.getData().getString("String_Node_Str"));
default :
}
}
Program: 187183
Project: 187183
Buggy source:
public static void updateLessonResource(Context context,Lesson lesson,String locale) throws IOException {
  File fileIdx=new File(lesson.mResourcePath);
  InputStream is=context.getAssets().open("String_Node_Str" + locale);
  OutputStream os=new java.io.FileOutputStream(fileIdx);
  IOUtils.copyLarge(is,os);
}

Fixed version (ground truth):
public static void updateLessonResource(Context context,Lesson lesson,String locale) throws IOException {
  File fileIdx=new File(lesson.mResourcePath);
  InputStream is=context.getAssets().open("String_Node_Str" + locale);
  OutputStream os=new java.io.FileOutputStream(fileIdx);
  IOUtils.copy(is,os);
}
Program: 187185
Project: 187185
Buggy source:
/** 
 * Unpacks the give zip file using the built in Java facilities for unzip. 
 */
@SuppressWarnings("String_Node_Str") public void unpack(File zipFile,File rootDir) throws IOException {
  ZipFile zip=new ZipFile(zipFile);
  Enumeration<ZipEntry> entries=(Enumeration<ZipEntry>)zip.entries();
  ZipEntry entry=null;
  while (entries.hasMoreElements()) {
    entry=entries.nextElement();
    java.io.File f=new java.io.File(rootDir,entry.getName());
    if (entry.isDirectory()) {
      continue;
    }
    if (!f.exists()) {
      f.getParentFile().mkdirs();
      f.createNewFile();
    }
    InputStream is=zip.getInputStream(entry);
    OutputStream os=new java.io.FileOutputStream(f);
    IOUtils.copyLarge(is,os);
  }
}

Fixed version (ground truth):
/** 
 * Unpacks the give zip file using the built in Java facilities for unzip. 
 */
@SuppressWarnings("String_Node_Str") public void unpack(File zipFile,File rootDir) throws IOException {
  ZipFile zip=new ZipFile(zipFile);
  Enumeration<ZipEntry> entries=(Enumeration<ZipEntry>)zip.entries();
  ZipEntry entry=null;
  while (entries.hasMoreElements()) {
    entry=entries.nextElement();
    java.io.File f=new java.io.File(rootDir,entry.getName());
    if (entry.isDirectory()) {
      continue;
    }
    if (!f.exists()) {
      f.getParentFile().mkdirs();
      f.createNewFile();
    }
    InputStream is=zip.getInputStream(entry);
    OutputStream os=new java.io.FileOutputStream(f);
    IOUtils.copy(is,os);
  }
}
Program: 187187
Project: 187187
Buggy source:
private void initApp(){
  try {
    initServerUrls(this);
    SharedPreferences settings=PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
    String customLessonLoc=settings.getString("String_Node_Str",null);
    String lessonUrlPath=mBaseUrl + URL_PATH_LESSONS + mLocale.getLanguage()+ "String_Node_Str";
    String lessonLocalPath="String_Node_Str" + mLocale.getLanguage();
    if (customLessonLoc != null) {
      if (customLessonLoc.toLowerCase().startsWith("String_Node_Str")) {
        lessonUrlPath=customLessonLoc;
        lessonLocalPath="String_Node_Str" + lessonUrlPath.substring(lessonUrlPath.lastIndexOf('/') + 1);
      }
 else {
        lessonUrlPath=mBaseUrl + URL_PATH_LESSONS + customLessonLoc+ "String_Node_Str";
        lessonLocalPath="String_Node_Str" + customLessonLoc;
      }
    }
    File fileDirLessons=new File(getExternalFilesDir(null),lessonLocalPath);
    fileDirLessons.mkdirs();
    mLessonManager=new LessonManager(this,lessonUrlPath,fileDirLessons);
    mServerManager=new ServerManager(getApplicationContext());
  }
 catch (  Exception e) {
    Log.e(AppConstants.TAG,"String_Node_Str",e);
  }
}

Fixed version (ground truth):
private void initApp(){
  try {
    initServerUrls(this);
    SharedPreferences settings=PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
    String customLessonLoc=settings.getString("String_Node_Str",null);
    String lessonUrlPath=mBaseUrl + URL_PATH_LESSONS + mLocale.getLanguage()+ "String_Node_Str";
    String lessonLocalPath="String_Node_Str" + mLocale.getLanguage();
    if (customLessonLoc != null && customLessonLoc.length() > 0) {
      if (customLessonLoc.toLowerCase().startsWith("String_Node_Str")) {
        lessonUrlPath=customLessonLoc;
        lessonLocalPath="String_Node_Str" + lessonUrlPath.substring(lessonUrlPath.lastIndexOf('/') + 1);
      }
 else {
        lessonUrlPath=mBaseUrl + URL_PATH_LESSONS + customLessonLoc+ "String_Node_Str";
        lessonLocalPath="String_Node_Str" + customLessonLoc;
      }
    }
    File fileDirLessons=new File(getExternalFilesDir(null),lessonLocalPath);
    fileDirLessons.mkdirs();
    mLessonManager=new LessonManager(this,lessonUrlPath,fileDirLessons);
    mServerManager=new ServerManager(getApplicationContext());
  }
 catch (  Exception e) {
    Log.e(AppConstants.TAG,"String_Node_Str",e);
  }
}
Program: 187188
Project: 187188
Buggy source:
public boolean checkLocale(){
  SharedPreferences settings=PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
  Configuration config=getResources().getConfiguration();
  boolean useLangAr=settings.getBoolean("String_Node_Str",false);
  String lang=settings.getString(PREF_LOCALE,LOCALE_DEFAULT);
  if (useLangAr)   lang=LANG_ARABIC;
  boolean updatedLocale=false;
  if (!"String_Node_Str".equals(lang) && !config.locale.getLanguage().equals(lang)) {
    mLocale=new Locale(lang);
    Locale.setDefault(mLocale);
    config.locale=mLocale;
    getResources().updateConfiguration(config,getResources().getDisplayMetrics());
    updatedLocale=true;
  }
 else   if (Locale.getDefault().getLanguage().equalsIgnoreCase(LANG_ARABIC)) {
    mLocale=Locale.getDefault();
    config.locale=mLocale;
    getResources().updateConfiguration(config,getResources().getDisplayMetrics());
    updatedLocale=true;
  }
  if (updatedLocale) {
    File fileDirLessons=new File(getExternalFilesDir(null),"String_Node_Str" + lang);
    fileDirLessons.mkdirs();
    mLessonManager=new LessonManager(this,mBaseUrl + URL_PATH_LESSONS + lang+ "String_Node_Str",fileDirLessons);
  }
  return updatedLocale;
}

Fixed version (ground truth):
public boolean checkLocale(){
  SharedPreferences settings=PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
  Configuration config=getResources().getConfiguration();
  boolean useLangAr=settings.getBoolean("String_Node_Str",false);
  String lang=settings.getString(PREF_LOCALE,LOCALE_DEFAULT);
  if (useLangAr)   lang=LANG_ARABIC;
  boolean updatedLocale=false;
  if (!"String_Node_Str".equals(lang) && !config.locale.getLanguage().equals(lang)) {
    mLocale=new Locale(lang);
    Locale.setDefault(mLocale);
    config.locale=mLocale;
    getResources().updateConfiguration(config,getResources().getDisplayMetrics());
    updatedLocale=true;
    lang=config.locale.getLanguage();
  }
 else   if (Locale.getDefault().getLanguage().equalsIgnoreCase(LANG_ARABIC)) {
    mLocale=Locale.getDefault();
    config.locale=mLocale;
    getResources().updateConfiguration(config,getResources().getDisplayMetrics());
    updatedLocale=true;
    lang=config.locale.getLanguage();
  }
  if (updatedLocale) {
    File fileDirLessons=new File(getExternalFilesDir(null),"String_Node_Str" + lang);
    fileDirLessons.mkdirs();
    mLessonManager=new LessonManager(this,mBaseUrl + URL_PATH_LESSONS + lang+ "String_Node_Str",fileDirLessons);
  }
  return updatedLocale;
}
Program: 187189
Project: 187189
Buggy source:
@Override public void onRearrange(int oldIndex,int newIndex){
  mMPM.mScene.swapMediaIndex(oldIndex,newIndex);
  mActivity.mdExported=null;
}

Fixed version (ground truth):
@Override public void onRearrange(int oldIndex,int newIndex){
  mMPM.mScene.moveMedia(oldIndex,newIndex);
  mActivity.mdExported=null;
}
Program: 187190
Project: 187190
Buggy source:
public void loadMedia(){
  mOrderClipsDGV.removeAllViews();
  Media[] sceneMedias=mMPM.mScene.getMediaAsArray();
  for (int i=0; i < sceneMedias.length; i++) {
    ImageView iv=new ImageView(getActivity());
    if (sceneMedias[i] != null) {
      iv.setImageBitmap(mActivity.getThumbnail(sceneMedias[i]));
    }
 else {
      iv.setImageDrawable(getResources().getDrawable(R.drawable.thumb_incomplete));
    }
    mOrderClipsDGV.addView(iv);
  }
  mOrderClipsDGV.setOnRearrangeListener(new OnRearrangeListener(){
    @Override public void onRearrange(    int oldIndex,    int newIndex){
      mMPM.mScene.swapMediaIndex(oldIndex,newIndex);
      mActivity.mdExported=null;
    }
  }
);
  mOrderClipsDGV.setOnItemClickListener(new OnItemClickListener(){
    @Override public void onItemClick(    AdapterView<?> parent,    View view,    int position,    long id){
      if (!mTrimMode) {
        Log.d(TAG,"String_Node_Str");
        mCurrentClipIdx=position;
        showThumbnail(position);
      }
    }
  }
);
}

Fixed version (ground truth):
public void loadMedia(){
  mOrderClipsDGV.removeAllViews();
  Media[] sceneMedias=mMPM.mScene.getMediaAsArray();
  for (int i=0; i < sceneMedias.length; i++) {
    ImageView iv=new ImageView(getActivity());
    if (sceneMedias[i] != null) {
      iv.setImageBitmap(mActivity.getThumbnail(sceneMedias[i]));
    }
 else {
      iv.setImageDrawable(getResources().getDrawable(R.drawable.thumb_incomplete));
    }
    mOrderClipsDGV.addView(iv);
  }
  mOrderClipsDGV.setOnRearrangeListener(new OnRearrangeListener(){
    @Override public void onRearrange(    int oldIndex,    int newIndex){
      mMPM.mScene.moveMedia(oldIndex,newIndex);
      mActivity.mdExported=null;
    }
  }
);
  mOrderClipsDGV.setOnItemClickListener(new OnItemClickListener(){
    @Override public void onItemClick(    AdapterView<?> parent,    View view,    int position,    long id){
      if (!mTrimMode) {
        Log.d(TAG,"String_Node_Str");
        mCurrentClipIdx=position;
        showThumbnail(position);
      }
    }
  }
);
}
Program: 187193
Project: 187193
Buggy source:
@Override protected void onActivityResult(int arg0,int arg1,Intent arg2){
  super.onActivityResult(arg0,arg1,arg2);
  boolean changed=((StoryMakerApp)getApplication()).checkLocale();
  if (changed) {
    startActivity(new Intent(this,HomeActivity.class));
  }
}

Fixed version (ground truth):
@Override protected void onActivityResult(int arg0,int arg1,Intent arg2){
  super.onActivityResult(arg0,arg1,arg2);
  boolean changed=((StoryMakerApp)getApplication()).checkLocale();
  if (changed) {
    finish();
    startActivity(new Intent(this,HomeActivity.class));
  }
}
Program: 187194
Project: 187194
Buggy source:
@Override public void onResume(){
  super.onResume();
  new getAsynctask().execute("String_Node_Str");
}

Fixed version (ground truth):
@Override public void onResume(){
  super.onResume();
  new getAsynctask().execute("String_Node_Str");
  boolean isExternalStorageReady=((StoryMakerApp)getApplication()).isExternalStorageReady();
  if (!isExternalStorageReady) {
    new AlertDialog.Builder(this).setTitle(getString(R.string.app_name)).setIcon(android.R.drawable.ic_dialog_info).setMessage(R.string.err_storage_not_ready).show();
  }
}
Program: 187196
Project: 187196
Buggy source:
public void loadMedia(){
  mOrderClipsDGV.removeAllViews();
  Media[] sceneMedias=mMPM.mScene.getMediaAsArray();
  for (int i=0; i < sceneMedias.length; i++) {
    ImageView iv=new ImageView(getActivity());
    if (sceneMedias[i] != null) {
      iv.setImageBitmap(mActivity.getThumbnail(sceneMedias[i]));
    }
 else {
      iv.setImageDrawable(getResources().getDrawable(R.drawable.thumb_incomplete));
    }
    mOrderClipsDGV.addView(iv);
  }
  mOrderClipsDGV.setOnRearrangeListener(new OnRearrangeListener(){
    @Override public void onRearrange(    int oldIndex,    int newIndex){
      mMPM.mScene.moveMedia(oldIndex,newIndex);
    }
  }
);
  mOrderClipsDGV.setOnItemClickListener(new OnItemClickListener(){
    @Override public void onItemClick(    AdapterView<?> parent,    View view,    int position,    long id){
      if (!mTrimMode) {
        Log.d(TAG,"String_Node_Str");
        mCurrentClipIdx=position;
        previewClip(position);
      }
    }
  }
);
}

Fixed version (ground truth):
public void loadMedia(){
  mOrderClipsDGV.removeAllViews();
  Media[] sceneMedias=mMPM.mScene.getMediaAsArray();
  for (int i=0; i < sceneMedias.length; i++) {
    ImageView iv=new ImageView(getActivity());
    if (sceneMedias[i] != null) {
      Bitmap thumb=Media.getThumbnail(mActivity,sceneMedias[i],mActivity.mMPM.mProject);
      iv.setImageBitmap(thumb);
    }
 else {
      iv.setImageDrawable(getResources().getDrawable(R.drawable.thumb_incomplete));
    }
    mOrderClipsDGV.addView(iv);
  }
  mOrderClipsDGV.setOnRearrangeListener(new OnRearrangeListener(){
    @Override public void onRearrange(    int oldIndex,    int newIndex){
      mMPM.mScene.moveMedia(oldIndex,newIndex);
    }
  }
);
  mOrderClipsDGV.setOnItemClickListener(new OnItemClickListener(){
    @Override public void onItemClick(    AdapterView<?> parent,    View view,    int position,    long id){
      if (!mTrimMode) {
        Log.d(TAG,"String_Node_Str");
        mCurrentClipIdx=position;
        previewClip(position);
      }
    }
  }
);
}