Program: 15098
Project: 15098
Buggy source:
@Override protected Boolean doInBackground(Post... posts){
  post=posts[0];
  nm=(NotificationManager)context.getSystemService("String_Node_Str");
  String postOrPage=(String)(post.isPage() ? context.getResources().getText(R.string.page_id) : context.getResources().getText(R.string.post_id));
  String message=context.getResources().getText(R.string.uploading) + "String_Node_Str" + postOrPage;
  n=new Notification(R.drawable.notification_icon,message,System.currentTimeMillis());
  Intent notificationIntent=new Intent(context,PostsActivity.class);
  notificationIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK | IntentCompat.FLAG_ACTIVITY_CLEAR_TASK);
  notificationIntent.setAction("String_Node_Str");
  notificationIntent.addCategory("String_Node_Str");
  notificationIntent.setData((Uri.parse("String_Node_Str" + post.getBlogID())));
  PendingIntent pendingIntent=PendingIntent.getActivity(context,0,notificationIntent,Intent.FLAG_ACTIVITY_CLEAR_TOP);
  n.setLatestEventInfo(context,message,message,pendingIntent);
  notificationID=22 + Integer.valueOf(post.getBlogID());
  nm.notify(notificationID,n);
  if (post.getPost_status() == null) {
    post.setPost_status("String_Node_Str");
  }
  Boolean publishThis=false;
  Spannable s;
  String descriptionContent="String_Node_Str", moreContent="String_Node_Str";
  int moreCount=1;
  if (post.getMt_text_more() != null)   moreCount++;
  String imgTags="String_Node_Str";
  Pattern pattern=Pattern.compile(imgTags);
  for (int x=0; x < moreCount; x++) {
    if (post.isLocalDraft()) {
      if (x == 0)       s=(Spannable)WPHtml.fromHtml(post.getDescription(),context,post);
 else       s=(Spannable)WPHtml.fromHtml(post.getMt_text_more(),context,post);
      WPImageSpan[] click_spans=s.getSpans(0,s.length(),WPImageSpan.class);
      if (click_spans.length != 0) {
        for (int i=0; i < click_spans.length; i++) {
          String prompt=context.getResources().getText(R.string.uploading_media_item) + String.valueOf(i + 1);
          n.setLatestEventInfo(context,context.getResources().getText(R.string.uploading) + "String_Node_Str" + postOrPage,prompt,n.contentIntent);
          nm.notify(notificationID,n);
          WPImageSpan wpIS=click_spans[i];
          int start=s.getSpanStart(wpIS);
          int end=s.getSpanEnd(wpIS);
          MediaFile mf=new MediaFile();
          mf.setPostID(post.getId());
          mf.setTitle(wpIS.getTitle());
          mf.setCaption(wpIS.getCaption());
          mf.setDescription(wpIS.getDescription());
          mf.setFeatured(wpIS.isFeatured());
          mf.setFeaturedInPost(wpIS.isFeaturedInPost());
          mf.setFileName(wpIS.getImageSource().toString());
          mf.setHorizontalAlignment(wpIS.getHorizontalAlignment());
          mf.setWidth(wpIS.getWidth());
          String imgHTML=uploadMediaFile(mf);
          if (imgHTML != null) {
            SpannableString ss=new SpannableString(imgHTML);
            s.setSpan(ss,start,end,Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
            s.removeSpan(wpIS);
          }
 else {
            s.removeSpan(wpIS);
            mediaError=true;
          }
        }
      }
      if (x == 0)       descriptionContent=WPHtml.toHtml(s);
 else       moreContent=WPHtml.toHtml(s);
    }
 else {
      Matcher matcher;
      if (x == 0) {
        descriptionContent=post.getDescription();
        matcher=pattern.matcher(descriptionContent);
      }
 else {
        moreContent=post.getMt_text_more();
        matcher=pattern.matcher(moreContent);
      }
      List<String> imageTags=new ArrayList<String>();
      while (matcher.find()) {
        imageTags.add(matcher.group());
      }
      for (      String tag : imageTags) {
        Pattern p=Pattern.compile("String_Node_Str");
        Matcher m=p.matcher(tag);
        String imgPath="String_Node_Str";
        if (m.find()) {
          imgPath=m.group(1);
          if (!imgPath.equals("String_Node_Str")) {
            MediaFile mf=WordPress.wpDB.getMediaFile(imgPath,post);
            if (mf != null) {
              String imgHTML=uploadMediaFile(mf);
              if (imgHTML != null) {
                if (x == 0) {
                  descriptionContent=descriptionContent.replace(tag,imgHTML);
                }
 else {
                  moreContent=moreContent.replace(tag,imgHTML);
                }
              }
 else {
                if (x == 0)                 descriptionContent=descriptionContent.replace(tag,"String_Node_Str");
 else                 moreContent=moreContent.replace(tag,"String_Node_Str");
                mediaError=true;
              }
            }
          }
        }
      }
    }
  }
  if (mediaError)   return false;
  JSONArray categories=post.getJSONCategories();
  String[] theCategories=null;
  if (categories != null) {
    theCategories=new String[categories.length()];
    for (int i=0; i < categories.length(); i++) {
      try {
        theCategories[i]=TextUtils.htmlEncode(categories.getString(i));
      }
 catch (      JSONException e) {
        e.printStackTrace();
      }
    }
  }
  Map<String,Object> contentStruct=new HashMap<String,Object>();
  if (!post.isPage() && post.isLocalDraft()) {
    SharedPreferences prefs=PreferenceManager.getDefaultSharedPreferences(context);
    String tagline="String_Node_Str";
    if (prefs.getBoolean("String_Node_Str",false)) {
      tagline=prefs.getString("String_Node_Str","String_Node_Str");
      if (tagline != null) {
        String tag="String_Node_Str" + tagline + "String_Node_Str";
        if (moreContent == "String_Node_Str")         descriptionContent+=tag;
 else         moreContent+=tag;
      }
    }
    if (!post.getWP_post_format().equals("String_Node_Str")) {
      if (!post.getWP_post_format().equals("String_Node_Str"))       contentStruct.put("String_Node_Str",post.getWP_post_format());
    }
  }
  contentStruct.put("String_Node_Str",(post.isPage()) ? "String_Node_Str" : "String_Node_Str");
  contentStruct.put("String_Node_Str",post.getTitle());
  long pubDate=post.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 (!moreContent.equals("String_Node_Str")) {
    descriptionContent=descriptionContent.trim() + "String_Node_Str" + moreContent;
    post.setMt_text_more("String_Node_Str");
  }
  if (post.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 (!post.isPage()) {
    if (post.getMt_keywords() != "String_Node_Str") {
      contentStruct.put("String_Node_Str",post.getMt_keywords());
    }
    if (theCategories != null) {
      if (theCategories.length > 0)       contentStruct.put("String_Node_Str",theCategories);
    }
  }
  if (post.getMt_excerpt() != null)   contentStruct.put("String_Node_Str",post.getMt_excerpt());
  contentStruct.put((post.isPage()) ? "String_Node_Str" : "String_Node_Str",post.getPost_status());
  Double latitude=0.0;
  Double longitude=0.0;
  if (!post.isPage()) {
    latitude=(Double)post.getLatitude();
    longitude=(Double)post.getLongitude();
    if (latitude > 0) {
      Map<Object,Object> hLatitude=new HashMap<Object,Object>();
      hLatitude.put("String_Node_Str","String_Node_Str");
      hLatitude.put("String_Node_Str",latitude);
      Map<Object,Object> hLongitude=new HashMap<Object,Object>();
      hLongitude.put("String_Node_Str","String_Node_Str");
      hLongitude.put("String_Node_Str",longitude);
      Map<Object,Object> hPublic=new HashMap<Object,Object>();
      hPublic.put("String_Node_Str","String_Node_Str");
      hPublic.put("String_Node_Str",1);
      Object[] geo={hLatitude,hLongitude,hPublic};
      contentStruct.put("String_Node_Str",geo);
    }
  }
  if (featuredImageID != -1)   contentStruct.put("String_Node_Str",featuredImageID);
  XMLRPCClient client=new XMLRPCClient(post.getBlog().getUrl(),post.getBlog().getHttpuser(),post.getBlog().getHttppassword());
  if (post.getQuickPostType() != null)   client.addQuickPostHeader(post.getQuickPostType());
  n.setLatestEventInfo(context,message,message,n.contentIntent);
  nm.notify(notificationID,n);
  if (post.getWP_password() != null) {
    contentStruct.put("String_Node_Str",post.getWP_password());
  }
  Object[] params;
  if (post.isLocalDraft() && !post.isUploaded())   params=new Object[]{post.getBlog().getBlogId(),post.getBlog().getUsername(),post.getBlog().getPassword(),contentStruct,publishThis};
 else   params=new Object[]{post.getPostid(),post.getBlog().getUsername(),post.getBlog().getPassword(),contentStruct,publishThis};
  try {
    client.call((post.isLocalDraft() && !post.isUploaded()) ? "String_Node_Str" : "String_Node_Str",params);
    post.setUploaded(true);
    post.setLocalChange(false);
    post.update();
    return true;
  }
 catch (  final XMLRPCException e) {
    error=String.format(context.getResources().getText(R.string.error_upload).toString(),post.isPage() ? context.getResources().getText(R.string.page).toString() : context.getResources().getText(R.string.post).toString()) + "String_Node_Str" + cleanXMLRPCErrorMessage(e.getMessage());
    mediaError=false;
    Log.i("String_Node_Str",error);
  }
  return false;
}

Fixed version (ground truth):
@Override protected Boolean doInBackground(Post... posts){
  post=posts[0];
  nm=(NotificationManager)context.getSystemService("String_Node_Str");
  String postOrPage=(String)(post.isPage() ? context.getResources().getText(R.string.page_id) : context.getResources().getText(R.string.post_id));
  String message=context.getResources().getText(R.string.uploading) + "String_Node_Str" + postOrPage;
  n=new Notification(R.drawable.notification_icon,message,System.currentTimeMillis());
  Intent notificationIntent=new Intent(context,PostsActivity.class);
  notificationIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK | IntentCompat.FLAG_ACTIVITY_CLEAR_TASK);
  notificationIntent.setAction("String_Node_Str");
  notificationIntent.addCategory("String_Node_Str");
  notificationIntent.setData((Uri.parse("String_Node_Str" + post.getBlogID())));
  PendingIntent pendingIntent=PendingIntent.getActivity(context,0,notificationIntent,Intent.FLAG_ACTIVITY_CLEAR_TOP);
  n.setLatestEventInfo(context,message,message,pendingIntent);
  notificationID=22 + Integer.valueOf(post.getBlogID());
  nm.notify(notificationID,n);
  if (post.getPost_status() == null) {
    post.setPost_status("String_Node_Str");
  }
  Boolean publishThis=false;
  Spannable s;
  String descriptionContent="String_Node_Str", moreContent="String_Node_Str";
  int moreCount=1;
  if (post.getMt_text_more() != null)   moreCount++;
  String imgTags="String_Node_Str";
  Pattern pattern=Pattern.compile(imgTags);
  for (int x=0; x < moreCount; x++) {
    if (post.isLocalDraft()) {
      if (x == 0)       s=(Spannable)WPHtml.fromHtml(post.getDescription(),context,post);
 else       s=(Spannable)WPHtml.fromHtml(post.getMt_text_more(),context,post);
      WPImageSpan[] click_spans=s.getSpans(0,s.length(),WPImageSpan.class);
      if (click_spans.length != 0) {
        for (int i=0; i < click_spans.length; i++) {
          String prompt=context.getResources().getText(R.string.uploading_media_item) + String.valueOf(i + 1);
          n.setLatestEventInfo(context,context.getResources().getText(R.string.uploading) + "String_Node_Str" + postOrPage,prompt,n.contentIntent);
          nm.notify(notificationID,n);
          WPImageSpan wpIS=click_spans[i];
          int start=s.getSpanStart(wpIS);
          int end=s.getSpanEnd(wpIS);
          MediaFile mf=new MediaFile();
          mf.setPostID(post.getId());
          mf.setTitle(wpIS.getTitle());
          mf.setCaption(wpIS.getCaption());
          mf.setDescription(wpIS.getDescription());
          mf.setFeatured(wpIS.isFeatured());
          mf.setFeaturedInPost(wpIS.isFeaturedInPost());
          mf.setFileName(wpIS.getImageSource().toString());
          mf.setHorizontalAlignment(wpIS.getHorizontalAlignment());
          mf.setWidth(wpIS.getWidth());
          String imgHTML=uploadMediaFile(mf);
          if (imgHTML != null) {
            SpannableString ss=new SpannableString(imgHTML);
            s.setSpan(ss,start,end,Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
            s.removeSpan(wpIS);
          }
 else {
            s.removeSpan(wpIS);
            mediaError=true;
          }
        }
      }
      if (x == 0)       descriptionContent=WPHtml.toHtml(s);
 else       moreContent=WPHtml.toHtml(s);
    }
 else {
      Matcher matcher;
      if (x == 0) {
        descriptionContent=post.getDescription();
        matcher=pattern.matcher(descriptionContent);
      }
 else {
        moreContent=post.getMt_text_more();
        matcher=pattern.matcher(moreContent);
      }
      List<String> imageTags=new ArrayList<String>();
      while (matcher.find()) {
        imageTags.add(matcher.group());
      }
      for (      String tag : imageTags) {
        Pattern p=Pattern.compile("String_Node_Str");
        Matcher m=p.matcher(tag);
        String imgPath="String_Node_Str";
        if (m.find()) {
          imgPath=m.group(1);
          if (!imgPath.equals("String_Node_Str")) {
            MediaFile mf=WordPress.wpDB.getMediaFile(imgPath,post);
            if (mf != null) {
              String imgHTML=uploadMediaFile(mf);
              if (imgHTML != null) {
                if (x == 0) {
                  descriptionContent=descriptionContent.replace(tag,imgHTML);
                }
 else {
                  moreContent=moreContent.replace(tag,imgHTML);
                }
              }
 else {
                if (x == 0)                 descriptionContent=descriptionContent.replace(tag,"String_Node_Str");
 else                 moreContent=moreContent.replace(tag,"String_Node_Str");
                mediaError=true;
              }
            }
          }
        }
      }
    }
  }
  if (mediaError)   return false;
  JSONArray categoriesJsonArray=post.getJSONCategories();
  String[] theCategories=null;
  if (categoriesJsonArray != null) {
    theCategories=new String[categoriesJsonArray.length()];
    for (int i=0; i < categoriesJsonArray.length(); i++) {
      try {
        theCategories[i]=TextUtils.htmlEncode(categoriesJsonArray.getString(i));
      }
 catch (      JSONException e) {
        e.printStackTrace();
      }
    }
  }
  Map<String,Object> contentStruct=new HashMap<String,Object>();
  if (!post.isPage() && post.isLocalDraft()) {
    SharedPreferences prefs=PreferenceManager.getDefaultSharedPreferences(context);
    String tagline="String_Node_Str";
    if (prefs.getBoolean("String_Node_Str",false)) {
      tagline=prefs.getString("String_Node_Str","String_Node_Str");
      if (tagline != null) {
        String tag="String_Node_Str" + tagline + "String_Node_Str";
        if (moreContent == "String_Node_Str")         descriptionContent+=tag;
 else         moreContent+=tag;
      }
    }
    if (!post.getWP_post_format().equals("String_Node_Str")) {
      if (!post.getWP_post_format().equals("String_Node_Str"))       contentStruct.put("String_Node_Str",post.getWP_post_format());
    }
  }
  contentStruct.put("String_Node_Str",(post.isPage()) ? "String_Node_Str" : "String_Node_Str");
  contentStruct.put("String_Node_Str",post.getTitle());
  long pubDate=post.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 (!moreContent.equals("String_Node_Str")) {
    descriptionContent=descriptionContent.trim() + "String_Node_Str" + moreContent;
    post.setMt_text_more("String_Node_Str");
  }
  if (post.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 (!post.isPage()) {
    if (post.getMt_keywords() != "String_Node_Str") {
      contentStruct.put("String_Node_Str",post.getMt_keywords());
    }
    if (theCategories != null && theCategories.length > 0)     contentStruct.put("String_Node_Str",theCategories);
  }
  if (post.getMt_excerpt() != null)   contentStruct.put("String_Node_Str",post.getMt_excerpt());
  contentStruct.put((post.isPage()) ? "String_Node_Str" : "String_Node_Str",post.getPost_status());
  Double latitude=0.0;
  Double longitude=0.0;
  if (!post.isPage()) {
    latitude=(Double)post.getLatitude();
    longitude=(Double)post.getLongitude();
    if (latitude > 0) {
      Map<Object,Object> hLatitude=new HashMap<Object,Object>();
      hLatitude.put("String_Node_Str","String_Node_Str");
      hLatitude.put("String_Node_Str",latitude);
      Map<Object,Object> hLongitude=new HashMap<Object,Object>();
      hLongitude.put("String_Node_Str","String_Node_Str");
      hLongitude.put("String_Node_Str",longitude);
      Map<Object,Object> hPublic=new HashMap<Object,Object>();
      hPublic.put("String_Node_Str","String_Node_Str");
      hPublic.put("String_Node_Str",1);
      Object[] geo={hLatitude,hLongitude,hPublic};
      contentStruct.put("String_Node_Str",geo);
    }
  }
  if (featuredImageID != -1)   contentStruct.put("String_Node_Str",featuredImageID);
  XMLRPCClient client=new XMLRPCClient(post.getBlog().getUrl(),post.getBlog().getHttpuser(),post.getBlog().getHttppassword());
  if (post.getQuickPostType() != null)   client.addQuickPostHeader(post.getQuickPostType());
  n.setLatestEventInfo(context,message,message,n.contentIntent);
  nm.notify(notificationID,n);
  if (post.getWP_password() != null) {
    contentStruct.put("String_Node_Str",post.getWP_password());
  }
  Object[] params;
  if (post.isLocalDraft() && !post.isUploaded())   params=new Object[]{post.getBlog().getBlogId(),post.getBlog().getUsername(),post.getBlog().getPassword(),contentStruct,publishThis};
 else   params=new Object[]{post.getPostid(),post.getBlog().getUsername(),post.getBlog().getPassword(),contentStruct,publishThis};
  try {
    client.call((post.isLocalDraft() && !post.isUploaded()) ? "String_Node_Str" : "String_Node_Str",params);
    post.setUploaded(true);
    post.setLocalChange(false);
    post.update();
    return true;
  }
 catch (  final XMLRPCException e) {
    error=String.format(context.getResources().getText(R.string.error_upload).toString(),post.isPage() ? context.getResources().getText(R.string.page).toString() : context.getResources().getText(R.string.post).toString()) + "String_Node_Str" + cleanXMLRPCErrorMessage(e.getMessage());
    mediaError=false;
    Log.i("String_Node_Str",error);
  }
  return false;
}