Program: 15180
Project: 15180
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,Posts.class);
  notificationIntent.setData((Uri.parse("String_Node_Str" + post.blogID)));
  notificationIntent.putExtra("String_Node_Str",true);
  PendingIntent pendingIntent=PendingIntent.getActivity(context,0,notificationIntent,Intent.FLAG_ACTIVITY_CLEAR_TOP);
  n.setLatestEventInfo(context,message,message,pendingIntent);
  notificationID=22 + Integer.valueOf(post.blogID);
  nm.notify(notificationID,n);
  if (post.post_status == null) {
    post.post_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.setFileName(wpIS.getImageSource().toString());
          mf.setHorizontalAlignment(wpIS.getHorizontalAlignment());
          mf.setWidth(wpIS.getWidth());
          String imgHTML=uploadImage(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);
      }
      while (matcher.find()) {
        String tag="String_Node_Str";
        if (x == 0)         tag=descriptionContent.substring(matcher.start(),matcher.end());
 else         tag=moreContent.substring(matcher.start(),matcher.end());
        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=uploadImage(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;
              }
            }
          }
        }
      }
    }
  }
  JSONArray categories=post.getCategories();
  String[] theCategories=null;
  if (categories != null) {
    theCategories=new String[categories.length()];
    for (int i=0; i < categories.length(); i++) {
      try {
        theCategories[i]=categories.getString(i);
      }
 catch (      JSONException e) {
        e.printStackTrace();
      }
    }
  }
  Map<String,Object> contentStruct=new HashMap<String,Object>();
  if (!post.isPage && post.isLocalDraft()) {
    HashMap<?,?> globalSettings=WordPress.wpDB.getNotificationOptions(context);
    boolean taglineValue=false;
    String tagline="String_Node_Str";
    if (globalSettings != null) {
      if (globalSettings.get("String_Node_Str").toString().equals("String_Node_Str")) {
        taglineValue=true;
      }
      if (taglineValue) {
        tagline=globalSettings.get("String_Node_Str").toString();
        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.title);
  long pubDate=post.date_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 + "String_Node_Str" + moreContent;
    post.mt_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.mt_keywords != "String_Node_Str") {
      contentStruct.put("String_Node_Str",post.mt_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.post_status);
  Double latitude=0.0;
  Double longitude=0.0;
  if (!post.isPage) {
    latitude=(Double)post.getLatitude();
    longitude=(Double)post.getLongitude();
    if (latitude > 0) {
      HashMap<Object,Object> hLatitude=new HashMap<Object,Object>();
      hLatitude.put("String_Node_Str","String_Node_Str");
      hLatitude.put("String_Node_Str",latitude);
      HashMap<Object,Object> hLongitude=new HashMap<Object,Object>();
      hLongitude.put("String_Node_Str","String_Node_Str");
      hLongitude.put("String_Node_Str",longitude);
      HashMap<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);
    }
  }
  XMLRPCClient client=new XMLRPCClient(post.blog.getUrl(),post.blog.getHttpuser(),post.blog.getHttppassword());
  if (post.quickPostType != null)   client.addQuickPostHeader(post.quickPostType);
  n.setLatestEventInfo(context,message,message,n.contentIntent);
  nm.notify(notificationID,n);
  if (post.wp_password != null) {
    contentStruct.put("String_Node_Str",post.wp_password);
  }
  Object[] params;
  if (post.isLocalDraft() && !post.uploaded)   params=new Object[]{post.blog.getBlogId(),post.blog.getUsername(),post.blog.getPassword(),contentStruct,publishThis};
 else   params=new Object[]{post.getPostid(),post.blog.getUsername(),post.blog.getPassword(),contentStruct,publishThis};
  try {
    client.call((post.isLocalDraft() && !post.uploaded) ? "String_Node_Str" : "String_Node_Str",params);
    post.setUploaded(true);
    post.setLocalChange(false);
    post.update();
    return true;
  }
 catch (  final XMLRPCException e) {
    error=e.getLocalizedMessage();
    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,Posts.class);
  notificationIntent.setData((Uri.parse("String_Node_Str" + post.blogID)));
  notificationIntent.putExtra("String_Node_Str",true);
  PendingIntent pendingIntent=PendingIntent.getActivity(context,0,notificationIntent,Intent.FLAG_ACTIVITY_CLEAR_TOP);
  n.setLatestEventInfo(context,message,message,pendingIntent);
  notificationID=22 + Integer.valueOf(post.blogID);
  nm.notify(notificationID,n);
  if (post.post_status == null) {
    post.post_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.setFileName(wpIS.getImageSource().toString());
          mf.setHorizontalAlignment(wpIS.getHorizontalAlignment());
          mf.setWidth(wpIS.getWidth());
          String imgHTML=uploadImage(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);
      }
      while (matcher.find()) {
        String tag="String_Node_Str";
        if (x == 0)         tag=descriptionContent.substring(matcher.start(),matcher.end());
 else         tag=moreContent.substring(matcher.start(),matcher.end());
        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=uploadImage(mf);
              if (imgHTML != null) {
                if (x == 0) {
                  descriptionContent=descriptionContent.replace(tag,imgHTML);
                  matcher=pattern.matcher(descriptionContent);
                }
 else {
                  moreContent=moreContent.replace(tag,imgHTML);
                  matcher=pattern.matcher(moreContent);
                }
              }
 else {
                if (x == 0)                 descriptionContent=descriptionContent.replace(tag,"String_Node_Str");
 else                 moreContent=moreContent.replace(tag,"String_Node_Str");
                mediaError=true;
              }
            }
          }
        }
      }
    }
  }
  JSONArray categories=post.getCategories();
  String[] theCategories=null;
  if (categories != null) {
    theCategories=new String[categories.length()];
    for (int i=0; i < categories.length(); i++) {
      try {
        theCategories[i]=categories.getString(i);
      }
 catch (      JSONException e) {
        e.printStackTrace();
      }
    }
  }
  Map<String,Object> contentStruct=new HashMap<String,Object>();
  if (!post.isPage && post.isLocalDraft()) {
    HashMap<?,?> globalSettings=WordPress.wpDB.getNotificationOptions(context);
    boolean taglineValue=false;
    String tagline="String_Node_Str";
    if (globalSettings != null) {
      if (globalSettings.get("String_Node_Str").toString().equals("String_Node_Str")) {
        taglineValue=true;
      }
      if (taglineValue) {
        tagline=globalSettings.get("String_Node_Str").toString();
        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.title);
  long pubDate=post.date_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 + "String_Node_Str" + moreContent;
    post.mt_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.mt_keywords != "String_Node_Str") {
      contentStruct.put("String_Node_Str",post.mt_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.post_status);
  Double latitude=0.0;
  Double longitude=0.0;
  if (!post.isPage) {
    latitude=(Double)post.getLatitude();
    longitude=(Double)post.getLongitude();
    if (latitude > 0) {
      HashMap<Object,Object> hLatitude=new HashMap<Object,Object>();
      hLatitude.put("String_Node_Str","String_Node_Str");
      hLatitude.put("String_Node_Str",latitude);
      HashMap<Object,Object> hLongitude=new HashMap<Object,Object>();
      hLongitude.put("String_Node_Str","String_Node_Str");
      hLongitude.put("String_Node_Str",longitude);
      HashMap<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);
    }
  }
  XMLRPCClient client=new XMLRPCClient(post.blog.getUrl(),post.blog.getHttpuser(),post.blog.getHttppassword());
  if (post.quickPostType != null)   client.addQuickPostHeader(post.quickPostType);
  n.setLatestEventInfo(context,message,message,n.contentIntent);
  nm.notify(notificationID,n);
  if (post.wp_password != null) {
    contentStruct.put("String_Node_Str",post.wp_password);
  }
  Object[] params;
  if (post.isLocalDraft() && !post.uploaded)   params=new Object[]{post.blog.getBlogId(),post.blog.getUsername(),post.blog.getPassword(),contentStruct,publishThis};
 else   params=new Object[]{post.getPostid(),post.blog.getUsername(),post.blog.getPassword(),contentStruct,publishThis};
  try {
    client.call((post.isLocalDraft() && !post.uploaded) ? "String_Node_Str" : "String_Node_Str",params);
    post.setUploaded(true);
    post.setLocalChange(false);
    post.update();
    return true;
  }
 catch (  final XMLRPCException e) {
    error=e.getLocalizedMessage();
    mediaError=false;
    Log.i("String_Node_Str",error);
  }
  return false;
}