Program: 13944
Project: 13944
Buggy source:
@Override protected Boolean doInBackground(Post... posts){
  mPost=posts[0];
  String postTitle=TextUtils.isEmpty(mPost.getTitle()) ? getString(R.string.untitled) : mPost.getTitle();
  String uploadingPostTitle=String.format(getString(R.string.posting_post),postTitle);
  String uploadingPostMessage=String.format(getString(R.string.sending_content),mPost.isPage() ? getString(R.string.page).toLowerCase() : getString(R.string.post).toLowerCase());
  mPostUploadNotifier=new PostUploadNotifier(mPost,uploadingPostTitle,uploadingPostMessage);
  mBlog=WordPress.wpDB.instantiateBlogByLocalId(mPost.getLocalTableBlogId());
  if (mBlog == null) {
    mErrorMessage=mContext.getString(R.string.blog_not_found);
    return false;
  }
  mClient=XMLRPCFactory.instantiate(mBlog.getUri(),mBlog.getHttpuser(),mBlog.getHttppassword());
  if (TextUtils.isEmpty(mPost.getPostStatus())) {
    mPost.setPostStatus(PostStatus.toString(PostStatus.PUBLISHED));
  }
  String descriptionContent=processPostMedia(mPost.getDescription());
  String moreContent="String_Node_Str";
  if (!TextUtils.isEmpty(mPost.getMoreText())) {
    moreContent=processPostMedia(mPost.getMoreText());
  }
  if (mIsMediaError) {
    return false;
  }
  JSONArray categoriesJsonArray=mPost.getJSONCategories();
  String[] postCategories=null;
  if (categoriesJsonArray != null) {
    if (categoriesJsonArray.length() > 0) {
      mHasCategory=true;
    }
    postCategories=new String[categoriesJsonArray.length()];
    for (int i=0; i < categoriesJsonArray.length(); i++) {
      try {
        postCategories[i]=TextUtils.htmlEncode(categoriesJsonArray.getString(i));
      }
 catch (      JSONException e) {
        AppLog.e(T.POSTS,e);
      }
    }
  }
  Map<String,Object> contentStruct=new HashMap<String,Object>();
  if (!mPost.isPage()) {
    if (!TextUtils.isEmpty(mPost.getPostFormat())) {
      contentStruct.put("String_Node_Str",mPost.getPostFormat());
    }
  }
  contentStruct.put("String_Node_Str",(mPost.isPage()) ? "String_Node_Str" : "String_Node_Str");
  contentStruct.put("String_Node_Str",mPost.getTitle());
  long pubDate=mPost.getDate_created_gmt();
  if (pubDate != 0) {
    Date date_created_gmt=new Date(pubDate);
    contentStruct.put("String_Node_Str",date_created_gmt);
    Date dateCreated=new Date(pubDate + (date_created_gmt.getTimezoneOffset() * 60000));
    contentStruct.put("String_Node_Str",dateCreated);
  }
  if (!TextUtils.isEmpty(moreContent)) {
    descriptionContent=descriptionContent.trim() + "String_Node_Str" + moreContent;
    mPost.setMoreText("String_Node_Str");
  }
  if (mPost.isLocalDraft()) {
    descriptionContent=descriptionContent.replace("String_Node_Str","String_Node_Str").replace("String_Node_Str","String_Node_Str").replace("String_Node_Str","String_Node_Str");
  }
  descriptionContent=descriptionContent.replaceAll("String_Node_Str","String_Node_Str");
  contentStruct.put("String_Node_Str",descriptionContent);
  if (!mPost.isPage()) {
    contentStruct.put("String_Node_Str",mPost.getKeywords());
    if (postCategories != null && postCategories.length > 0) {
      contentStruct.put("String_Node_Str",postCategories);
    }
  }
  contentStruct.put("String_Node_Str",mPost.getPostExcerpt());
  contentStruct.put((mPost.isPage()) ? "String_Node_Str" : "String_Node_Str",mPost.getPostStatus());
  if (mPost.supportsLocation()) {
    JSONObject remoteGeoLatitude=mPost.getCustomField("String_Node_Str");
    JSONObject remoteGeoLongitude=mPost.getCustomField("String_Node_Str");
    JSONObject remoteGeoPublic=mPost.getCustomField("String_Node_Str");
    Map<Object,Object> hLatitude=new HashMap<Object,Object>();
    Map<Object,Object> hLongitude=new HashMap<Object,Object>();
    Map<Object,Object> hPublic=new HashMap<Object,Object>();
    try {
      if (remoteGeoLatitude != null) {
        hLatitude.put("String_Node_Str",remoteGeoLatitude.getInt("String_Node_Str"));
      }
      if (remoteGeoLongitude != null) {
        hLongitude.put("String_Node_Str",remoteGeoLongitude.getInt("String_Node_Str"));
      }
      if (remoteGeoPublic != null) {
        hPublic.put("String_Node_Str",remoteGeoPublic.getInt("String_Node_Str"));
      }
      if (mPost.hasLocation()) {
        PostLocation location=mPost.getLocation();
        hLatitude.put("String_Node_Str","String_Node_Str");
        hLongitude.put("String_Node_Str","String_Node_Str");
        hPublic.put("String_Node_Str","String_Node_Str");
        hLatitude.put("String_Node_Str",location.getLatitude());
        hLongitude.put("String_Node_Str",location.getLongitude());
        hPublic.put("String_Node_Str",1);
      }
    }
 catch (    JSONException e) {
      AppLog.e(T.EDITOR,e);
    }
    if (!hLatitude.isEmpty() && !hLongitude.isEmpty() && !hPublic.isEmpty()) {
      Object[] geo={hLatitude,hLongitude,hPublic};
      contentStruct.put("String_Node_Str",geo);
    }
  }
  if (mUseLegacyMode) {
    if (featuredImageID != -1) {
      contentStruct.put("String_Node_Str",featuredImageID);
    }
  }
 else   if (mPost.featuredImageHasChanged()) {
    if (mPost.getFeaturedImageId() < 1 && !mPost.isLocalDraft()) {
      contentStruct.put("String_Node_Str","String_Node_Str");
    }
 else {
      contentStruct.put("String_Node_Str",mPost.getFeaturedImageId());
    }
  }
  if (!TextUtils.isEmpty(mPost.getQuickPostType())) {
    mClient.addQuickPostHeader(mPost.getQuickPostType());
  }
  contentStruct.put("String_Node_Str",mPost.getPassword());
  Object[] params;
  if (mPost.isLocalDraft())   params=new Object[]{mBlog.getRemoteBlogId(),mBlog.getUsername(),mBlog.getPassword(),contentStruct,false};
 else   params=new Object[]{mPost.getRemotePostId(),mBlog.getUsername(),mBlog.getPassword(),contentStruct,false};
  try {
    EventBus.getDefault().post(new PostUploadStarted(mPost.getLocalTableBlogId()));
    if (mPost.isLocalDraft()) {
      Object object=mClient.call("String_Node_Str",params);
      if (object instanceof String) {
        mPost.setRemotePostId((String)object);
      }
    }
 else {
      mClient.call("String_Node_Str",params);
    }
    mIsFirstPublishing=mPost.hasChangedFromDraftToPublished() || (mPost.isLocalDraft() && mPost.getStatusEnum() == PostStatus.PUBLISHED);
    mPost.setLocalDraft(false);
    mPost.setLocalChange(false);
    WordPress.wpDB.updatePost(mPost);
    if (mIsFirstPublishing) {
      trackUploadAnalytics();
    }
    ApiHelper.updateSinglePost(mBlog.getLocalTableBlogId(),mPost.getRemotePostId(),mPost.isPage());
    return true;
  }
 catch (  final XMLRPCException e) {
    setUploadPostErrorMessage(e);
  }
catch (  IOException e) {
    setUploadPostErrorMessage(e);
  }
catch (  XmlPullParserException e) {
    setUploadPostErrorMessage(e);
  }
  return false;
}

Fixed version (ground truth):
@Override protected Boolean doInBackground(Post... posts){
  mPost=posts[0];
  String postTitle=TextUtils.isEmpty(mPost.getTitle()) ? getString(R.string.untitled) : mPost.getTitle();
  String uploadingPostTitle=String.format(getString(R.string.posting_post),postTitle);
  String uploadingPostMessage=String.format(getString(R.string.sending_content),mPost.isPage() ? getString(R.string.page).toLowerCase() : getString(R.string.post).toLowerCase());
  mPostUploadNotifier=new PostUploadNotifier(mPost,uploadingPostTitle,uploadingPostMessage);
  mBlog=WordPress.wpDB.instantiateBlogByLocalId(mPost.getLocalTableBlogId());
  if (mBlog == null) {
    mErrorMessage=mContext.getString(R.string.blog_not_found);
    return false;
  }
  mClient=XMLRPCFactory.instantiate(mBlog.getUri(),mBlog.getHttpuser(),mBlog.getHttppassword());
  if (TextUtils.isEmpty(mPost.getPostStatus())) {
    mPost.setPostStatus(PostStatus.toString(PostStatus.PUBLISHED));
  }
  String descriptionContent=mPost.getDescription();
  if (descriptionContent.length() > 0 && descriptionContent.charAt(0) == '\u200B') {
    descriptionContent=descriptionContent.substring(1,descriptionContent.length());
  }
  descriptionContent=processPostMedia(descriptionContent);
  String moreContent="String_Node_Str";
  if (!TextUtils.isEmpty(mPost.getMoreText())) {
    moreContent=processPostMedia(mPost.getMoreText());
  }
  if (mIsMediaError) {
    return false;
  }
  JSONArray categoriesJsonArray=mPost.getJSONCategories();
  String[] postCategories=null;
  if (categoriesJsonArray != null) {
    if (categoriesJsonArray.length() > 0) {
      mHasCategory=true;
    }
    postCategories=new String[categoriesJsonArray.length()];
    for (int i=0; i < categoriesJsonArray.length(); i++) {
      try {
        postCategories[i]=TextUtils.htmlEncode(categoriesJsonArray.getString(i));
      }
 catch (      JSONException e) {
        AppLog.e(T.POSTS,e);
      }
    }
  }
  Map<String,Object> contentStruct=new HashMap<String,Object>();
  if (!mPost.isPage()) {
    if (!TextUtils.isEmpty(mPost.getPostFormat())) {
      contentStruct.put("String_Node_Str",mPost.getPostFormat());
    }
  }
  contentStruct.put("String_Node_Str",(mPost.isPage()) ? "String_Node_Str" : "String_Node_Str");
  contentStruct.put("String_Node_Str",mPost.getTitle());
  long pubDate=mPost.getDate_created_gmt();
  if (pubDate != 0) {
    Date date_created_gmt=new Date(pubDate);
    contentStruct.put("String_Node_Str",date_created_gmt);
    Date dateCreated=new Date(pubDate + (date_created_gmt.getTimezoneOffset() * 60000));
    contentStruct.put("String_Node_Str",dateCreated);
  }
  if (!TextUtils.isEmpty(moreContent)) {
    descriptionContent=descriptionContent.trim() + "String_Node_Str" + moreContent;
    mPost.setMoreText("String_Node_Str");
  }
  if (mPost.isLocalDraft()) {
    descriptionContent=descriptionContent.replace("String_Node_Str","String_Node_Str").replace("String_Node_Str","String_Node_Str").replace("String_Node_Str","String_Node_Str");
  }
  descriptionContent=descriptionContent.replaceAll("String_Node_Str","String_Node_Str");
  contentStruct.put("String_Node_Str",descriptionContent);
  if (!mPost.isPage()) {
    contentStruct.put("String_Node_Str",mPost.getKeywords());
    if (postCategories != null && postCategories.length > 0) {
      contentStruct.put("String_Node_Str",postCategories);
    }
  }
  contentStruct.put("String_Node_Str",mPost.getPostExcerpt());
  contentStruct.put((mPost.isPage()) ? "String_Node_Str" : "String_Node_Str",mPost.getPostStatus());
  if (mPost.supportsLocation()) {
    JSONObject remoteGeoLatitude=mPost.getCustomField("String_Node_Str");
    JSONObject remoteGeoLongitude=mPost.getCustomField("String_Node_Str");
    JSONObject remoteGeoPublic=mPost.getCustomField("String_Node_Str");
    Map<Object,Object> hLatitude=new HashMap<Object,Object>();
    Map<Object,Object> hLongitude=new HashMap<Object,Object>();
    Map<Object,Object> hPublic=new HashMap<Object,Object>();
    try {
      if (remoteGeoLatitude != null) {
        hLatitude.put("String_Node_Str",remoteGeoLatitude.getInt("String_Node_Str"));
      }
      if (remoteGeoLongitude != null) {
        hLongitude.put("String_Node_Str",remoteGeoLongitude.getInt("String_Node_Str"));
      }
      if (remoteGeoPublic != null) {
        hPublic.put("String_Node_Str",remoteGeoPublic.getInt("String_Node_Str"));
      }
      if (mPost.hasLocation()) {
        PostLocation location=mPost.getLocation();
        hLatitude.put("String_Node_Str","String_Node_Str");
        hLongitude.put("String_Node_Str","String_Node_Str");
        hPublic.put("String_Node_Str","String_Node_Str");
        hLatitude.put("String_Node_Str",location.getLatitude());
        hLongitude.put("String_Node_Str",location.getLongitude());
        hPublic.put("String_Node_Str",1);
      }
    }
 catch (    JSONException e) {
      AppLog.e(T.EDITOR,e);
    }
    if (!hLatitude.isEmpty() && !hLongitude.isEmpty() && !hPublic.isEmpty()) {
      Object[] geo={hLatitude,hLongitude,hPublic};
      contentStruct.put("String_Node_Str",geo);
    }
  }
  if (mUseLegacyMode) {
    if (featuredImageID != -1) {
      contentStruct.put("String_Node_Str",featuredImageID);
    }
  }
 else   if (mPost.featuredImageHasChanged()) {
    if (mPost.getFeaturedImageId() < 1 && !mPost.isLocalDraft()) {
      contentStruct.put("String_Node_Str","String_Node_Str");
    }
 else {
      contentStruct.put("String_Node_Str",mPost.getFeaturedImageId());
    }
  }
  if (!TextUtils.isEmpty(mPost.getQuickPostType())) {
    mClient.addQuickPostHeader(mPost.getQuickPostType());
  }
  contentStruct.put("String_Node_Str",mPost.getPassword());
  Object[] params;
  if (mPost.isLocalDraft())   params=new Object[]{mBlog.getRemoteBlogId(),mBlog.getUsername(),mBlog.getPassword(),contentStruct,false};
 else   params=new Object[]{mPost.getRemotePostId(),mBlog.getUsername(),mBlog.getPassword(),contentStruct,false};
  try {
    EventBus.getDefault().post(new PostUploadStarted(mPost.getLocalTableBlogId()));
    if (mPost.isLocalDraft()) {
      Object object=mClient.call("String_Node_Str",params);
      if (object instanceof String) {
        mPost.setRemotePostId((String)object);
      }
    }
 else {
      mClient.call("String_Node_Str",params);
    }
    mIsFirstPublishing=mPost.hasChangedFromDraftToPublished() || (mPost.isLocalDraft() && mPost.getStatusEnum() == PostStatus.PUBLISHED);
    mPost.setLocalDraft(false);
    mPost.setLocalChange(false);
    WordPress.wpDB.updatePost(mPost);
    if (mIsFirstPublishing) {
      trackUploadAnalytics();
    }
    ApiHelper.updateSinglePost(mBlog.getLocalTableBlogId(),mPost.getRemotePostId(),mPost.isPage());
    return true;
  }
 catch (  final XMLRPCException e) {
    setUploadPostErrorMessage(e);
  }
catch (  IOException e) {
    setUploadPostErrorMessage(e);
  }
catch (  XmlPullParserException e) {
    setUploadPostErrorMessage(e);
  }
  return false;
}