Program: 187207
Project: 187207
Buggy source:
private void handlePublish(final boolean doYouTube,final boolean doStoryMaker){
  EditText etTitle=(EditText)mActivity.findViewById(R.id.etStoryTitle);
  EditText etDesc=(EditText)mActivity.findViewById(R.id.editTextDescribe);
  final String exportFileName=mActivity.mMPM.mProject.getId() + "String_Node_Str" + new Date().getTime();
  mHandlerPub.sendEmptyMessage(999);
  final String title=etTitle.getText().toString();
  final String desc=etDesc.getText().toString();
  String ytdesc=desc;
  if (ytdesc.length() == 0) {
    ytdesc=getActivity().getString(R.string.default_youtube_desc);
  }
  final YouTubeSubmit yts=new YouTubeSubmit(null,title,ytdesc,new Date(),mActivity,mHandlerPub,mActivity.getBaseContext());
  Thread thread=new Thread(){
    public void run(){
      ServerManager sm=StoryMakerApp.getServerManager();
      sm.setContext(mActivity.getBaseContext());
      Message msg=mHandlerPub.obtainMessage(888);
      msg.getData().putString("String_Node_Str",getActivity().getString(R.string.rendering_clips_));
      mHandlerPub.sendMessage(msg);
      try {
        mActivity.mMPM.doExportMedia(exportFileName,doYouTube);
        mActivity.mdExported=mActivity.mMPM.getExportMedia();
        File mediaFile=new File(mActivity.mdExported.path);
        if (mediaFile.exists()) {
          Message message=mHandlerPub.obtainMessage(777);
          message.getData().putString("String_Node_Str",mActivity.mdExported.path);
          message.getData().putString("String_Node_Str",mActivity.mdExported.mimeType);
          if (doYouTube) {
            String mediaEmbed="String_Node_Str";
            if (mActivity.mMPM.mProject.getStoryType() == Project.STORY_TYPE_VIDEO || mActivity.mMPM.mProject.getStoryType() == Project.STORY_TYPE_ESSAY) {
              msg=mHandlerPub.obtainMessage(888);
              msg.getData().putString("String_Node_Str",getActivity().getString(R.string.uploading));
              msg.getData().putString("String_Node_Str",getActivity().getString(R.string.connecting_to_youtube_));
              mHandlerPub.sendMessage(msg);
              yts.setVideoFile(mediaFile,mActivity.mdExported.mimeType);
              yts.getAuthTokenWithPermission(mMediaUploadAccount);
              while (yts.videoId == null) {
                try {
                  Thread.sleep(1000);
                }
 catch (                Exception e) {
                }
              }
              mediaEmbed="String_Node_Str" + yts.videoId + "String_Node_Str";
              message.getData().putString("String_Node_Str",yts.videoId);
            }
 else             if (mActivity.mMPM.mProject.getStoryType() == Project.STORY_TYPE_AUDIO) {
              boolean installed=SoundCloudUploader.isCompatibleSoundCloudInstalled(mActivity.getBaseContext());
              if (installed) {
                String scurl=SoundCloudUploader.buildSoundCloudURL(mMediaUploadAccount,mediaFile,title);
                mediaEmbed="String_Node_Str" + scurl + "String_Node_Str";
                SoundCloudUploader.uploadSound(mediaFile,title,desc,REQ_SOUNDCLOUD,mActivity);
              }
 else {
                SoundCloudUploader.installSoundCloud(mActivity.getBaseContext());
              }
            }
 else             if (sm.hasCreds()) {
              String murl=sm.addMedia(mActivity.mdExported.mimeType,mediaFile);
              mediaEmbed=murl;
            }
            if (doStoryMaker) {
              String descWithMedia=desc + "String_Node_Str" + mediaEmbed;
              String postId=sm.post(title,descWithMedia);
              String urlPost=sm.getPostUrl(postId);
              message.getData().putString("String_Node_Str",urlPost);
            }
          }
          mHandlerPub.sendMessage(message);
        }
 else {
          Message msgErr=new Message();
          msgErr.what=-1;
          msgErr.getData().putString("String_Node_Str","String_Node_Str");
          mHandlerPub.sendMessage(msgErr);
        }
      }
 catch (      XmlRpcFault 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);
      }
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);
      }
    }
  }
;
  thread.start();
}

Fixed version (ground truth):
private void handlePublish(final boolean doYouTube,final boolean doStoryMaker){
  EditText etTitle=(EditText)mActivity.findViewById(R.id.etStoryTitle);
  EditText etDesc=(EditText)mActivity.findViewById(R.id.editTextDescribe);
  mHandlerPub.sendEmptyMessage(999);
  final String title=etTitle.getText().toString();
  final String desc=etDesc.getText().toString();
  String ytdesc=desc;
  if (ytdesc.length() == 0) {
    ytdesc=getActivity().getString(R.string.default_youtube_desc);
  }
  final YouTubeSubmit yts=new YouTubeSubmit(null,title,ytdesc,new Date(),mActivity,mHandlerPub,mActivity.getBaseContext());
  Thread thread=new Thread(){
    public void run(){
      ServerManager sm=StoryMakerApp.getServerManager();
      sm.setContext(mActivity.getBaseContext());
      Message msg=mHandlerPub.obtainMessage(888);
      msg.getData().putString("String_Node_Str",getActivity().getString(R.string.rendering_clips_));
      mHandlerPub.sendMessage(msg);
      try {
        File fileExport=mActivity.mMPM.getExportMediaFile();
        boolean overwrite=false;
        mActivity.mMPM.doExportMedia(fileExport,doYouTube,overwrite);
        mActivity.mdExported=mActivity.mMPM.getExportMedia();
        File mediaFile=new File(mActivity.mdExported.path);
        if (mediaFile.exists()) {
          Message message=mHandlerPub.obtainMessage(777);
          message.getData().putString("String_Node_Str",mActivity.mdExported.path);
          message.getData().putString("String_Node_Str",mActivity.mdExported.mimeType);
          if (doYouTube) {
            String mediaEmbed="String_Node_Str";
            if (mActivity.mMPM.mProject.getStoryType() == Project.STORY_TYPE_VIDEO || mActivity.mMPM.mProject.getStoryType() == Project.STORY_TYPE_ESSAY) {
              msg=mHandlerPub.obtainMessage(888);
              msg.getData().putString("String_Node_Str",getActivity().getString(R.string.uploading));
              msg.getData().putString("String_Node_Str",getActivity().getString(R.string.connecting_to_youtube_));
              mHandlerPub.sendMessage(msg);
              yts.setVideoFile(mediaFile,mActivity.mdExported.mimeType);
              yts.getAuthTokenWithPermission(mMediaUploadAccount);
              while (yts.videoId == null) {
                try {
                  Thread.sleep(1000);
                }
 catch (                Exception e) {
                }
              }
              mediaEmbed="String_Node_Str" + yts.videoId + "String_Node_Str";
              message.getData().putString("String_Node_Str",yts.videoId);
            }
 else             if (mActivity.mMPM.mProject.getStoryType() == Project.STORY_TYPE_AUDIO) {
              boolean installed=SoundCloudUploader.isCompatibleSoundCloudInstalled(mActivity.getBaseContext());
              if (installed) {
                String scurl=SoundCloudUploader.buildSoundCloudURL(mMediaUploadAccount,mediaFile,title);
                mediaEmbed="String_Node_Str" + scurl + "String_Node_Str";
                SoundCloudUploader.uploadSound(mediaFile,title,desc,REQ_SOUNDCLOUD,mActivity);
              }
 else {
                SoundCloudUploader.installSoundCloud(mActivity.getBaseContext());
              }
            }
 else             if (sm.hasCreds()) {
              String murl=sm.addMedia(mActivity.mdExported.mimeType,mediaFile);
              mediaEmbed=murl;
            }
            if (doStoryMaker) {
              String descWithMedia=desc + "String_Node_Str" + mediaEmbed;
              String[] categories=null;
              String postId=sm.post(title,descWithMedia,categories);
              String urlPost=sm.getPostUrl(postId);
              message.getData().putString("String_Node_Str",urlPost);
            }
          }
          mHandlerPub.sendMessage(message);
        }
 else {
          Message msgErr=new Message();
          msgErr.what=-1;
          msgErr.getData().putString("String_Node_Str","String_Node_Str");
          mHandlerPub.sendMessage(msgErr);
        }
      }
 catch (      XmlRpcFault 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);
      }
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);
      }
    }
  }
;
  thread.start();
}