Program: 13956
Project: 13956
Buggy source:
/** 
 * Updates post object with content of this fragment
 */
public void updatePostContent(boolean isAutoSave){
  Post post=getPost();
  if (post == null) {
    return;
  }
  String title=StringUtils.notNullStr((String)mEditorFragment.getTitle());
  SpannableStringBuilder postContent;
  if (mEditorFragment.getSpannedContent() != null) {
    try {
      postContent=new SpannableStringBuilder(mEditorFragment.getSpannedContent());
    }
 catch (    IndexOutOfBoundsException e) {
      postContent=new SpannableStringBuilder(StringUtils.notNullStr((String)mEditorFragment.getContent()));
    }
  }
 else {
    postContent=new SpannableStringBuilder(StringUtils.notNullStr((String)mEditorFragment.getContent()));
  }
  String content;
  if (post.isLocalDraft()) {
    CharacterStyle[] characterStyles=postContent.getSpans(0,postContent.length(),CharacterStyle.class);
    for (    CharacterStyle characterStyle : characterStyles) {
      if (characterStyle instanceof SuggestionSpan) {
        postContent.removeSpan(characterStyle);
      }
    }
    content=WPHtml.toHtml(postContent);
    content=content.replace("String_Node_Str","String_Node_Str");
    content=content.replace("String_Node_Str","String_Node_Str");
    content=content.replace("String_Node_Str","String_Node_Str");
    content=content.replace("String_Node_Str","String_Node_Str").replace("String_Node_Str","String_Node_Str").replace("String_Node_Str","String_Node_Str").replace("String_Node_Str","String_Node_Str").replace("String_Node_Str","String_Node_Str");
  }
 else {
    if (!isAutoSave) {
      MediaGalleryImageSpan[] gallerySpans=postContent.getSpans(0,postContent.length(),MediaGalleryImageSpan.class);
      for (      MediaGalleryImageSpan gallerySpan : gallerySpans) {
        int start=postContent.getSpanStart(gallerySpan);
        postContent.removeSpan(gallerySpan);
        postContent.insert(start,WPHtml.getGalleryShortcode(gallerySpan));
      }
    }
    WPImageSpan[] imageSpans=postContent.getSpans(0,postContent.length(),WPImageSpan.class);
    if (imageSpans.length != 0) {
      for (      WPImageSpan wpIS : imageSpans) {
        MediaFile mediaFile=wpIS.getMediaFile();
        if (mediaFile == null)         continue;
        if (mediaFile.getMediaId() != null) {
          updateMediaFileOnServer(wpIS);
        }
 else {
          mediaFile.setFileName(wpIS.getImageSource().toString());
          mediaFile.setFilePath(wpIS.getImageSource().toString());
          WordPress.wpDB.saveMediaFile(mediaFile);
        }
        int tagStart=postContent.getSpanStart(wpIS);
        if (!isAutoSave) {
          postContent.removeSpan(wpIS);
          if (mediaFile.getMediaId() != null && mediaFile.getMediaId().length() > 0) {
            postContent.insert(tagStart,WPHtml.getContent(wpIS));
          }
 else {
            postContent.insert(tagStart,"String_Node_Str" + wpIS.getImageSource().toString() + "String_Node_Str");
          }
        }
      }
    }
    content=postContent.toString();
  }
  String moreTag="String_Node_Str";
  post.setTitle(title);
  if (post.isLocalDraft() && content.contains(moreTag)) {
    post.setDescription(content.substring(0,content.indexOf(moreTag)));
    post.setMoreText(content.substring(content.indexOf(moreTag) + moreTag.length(),content.length()));
  }
 else {
    post.setDescription(content);
    post.setMoreText("String_Node_Str");
  }
  if (!post.isLocalDraft()) {
    post.setLocalChange(true);
  }
}

Fixed version (ground truth):
/** 
 * Updates post object with content of this fragment
 */
public void updatePostContent(boolean isAutoSave) throws IllegalEditorStateException {
  Post post=getPost();
  if (post == null) {
    return;
  }
  String title=StringUtils.notNullStr((String)mEditorFragment.getTitle());
  SpannableStringBuilder postContent;
  if (mEditorFragment.getSpannedContent() != null) {
    try {
      postContent=new SpannableStringBuilder(mEditorFragment.getSpannedContent());
    }
 catch (    IndexOutOfBoundsException e) {
      postContent=new SpannableStringBuilder(StringUtils.notNullStr((String)mEditorFragment.getContent()));
    }
  }
 else {
    postContent=new SpannableStringBuilder(StringUtils.notNullStr((String)mEditorFragment.getContent()));
  }
  String content;
  if (post.isLocalDraft()) {
    CharacterStyle[] characterStyles=postContent.getSpans(0,postContent.length(),CharacterStyle.class);
    for (    CharacterStyle characterStyle : characterStyles) {
      if (characterStyle instanceof SuggestionSpan) {
        postContent.removeSpan(characterStyle);
      }
    }
    content=WPHtml.toHtml(postContent);
    content=content.replace("String_Node_Str","String_Node_Str");
    content=content.replace("String_Node_Str","String_Node_Str");
    content=content.replace("String_Node_Str","String_Node_Str");
    content=content.replace("String_Node_Str","String_Node_Str").replace("String_Node_Str","String_Node_Str").replace("String_Node_Str","String_Node_Str").replace("String_Node_Str","String_Node_Str").replace("String_Node_Str","String_Node_Str");
  }
 else {
    if (!isAutoSave) {
      MediaGalleryImageSpan[] gallerySpans=postContent.getSpans(0,postContent.length(),MediaGalleryImageSpan.class);
      for (      MediaGalleryImageSpan gallerySpan : gallerySpans) {
        int start=postContent.getSpanStart(gallerySpan);
        postContent.removeSpan(gallerySpan);
        postContent.insert(start,WPHtml.getGalleryShortcode(gallerySpan));
      }
    }
    WPImageSpan[] imageSpans=postContent.getSpans(0,postContent.length(),WPImageSpan.class);
    if (imageSpans.length != 0) {
      for (      WPImageSpan wpIS : imageSpans) {
        MediaFile mediaFile=wpIS.getMediaFile();
        if (mediaFile == null)         continue;
        if (mediaFile.getMediaId() != null) {
          updateMediaFileOnServer(wpIS);
        }
 else {
          mediaFile.setFileName(wpIS.getImageSource().toString());
          mediaFile.setFilePath(wpIS.getImageSource().toString());
          WordPress.wpDB.saveMediaFile(mediaFile);
        }
        int tagStart=postContent.getSpanStart(wpIS);
        if (!isAutoSave) {
          postContent.removeSpan(wpIS);
          if (mediaFile.getMediaId() != null && mediaFile.getMediaId().length() > 0) {
            postContent.insert(tagStart,WPHtml.getContent(wpIS));
          }
 else {
            postContent.insert(tagStart,"String_Node_Str" + wpIS.getImageSource().toString() + "String_Node_Str");
          }
        }
      }
    }
    content=postContent.toString();
  }
  String moreTag="String_Node_Str";
  post.setTitle(title);
  if (post.isLocalDraft() && content.contains(moreTag)) {
    post.setDescription(content.substring(0,content.indexOf(moreTag)));
    post.setMoreText(content.substring(content.indexOf(moreTag) + moreTag.length(),content.length()));
  }
 else {
    post.setDescription(content);
    post.setMoreText("String_Node_Str");
  }
  if (!post.isLocalDraft()) {
    post.setLocalChange(true);
  }
}